add-command
/add-command
Dodaje podkomendę do narzędzia CLI w Rust, z obsługą, błędami, wyjściem i testami.
- Autor
- steamfield ↗
- Repozytorium
- stacks ↗
- Licencja
- Apache-2.0
- Ostatnia zmiana repozytorium
- 08.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 08.11.2026, bez odwołań do wycofanych modeli i API.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
Co robi i kiedy
Dodaje podkomendę do narzędzia CLI w Rust, z obsługą, błędami, wyjściem i testami.
Oryginalny opis (EN)
Add a subcommand to this Rust CLI with its handler, errors, output and tests. Use when the user asks for a new command, subcommand or option that does work.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 13 linii, 259 słów
Podgląd SKILL.md
--- name: add-command description: Add a subcommand to this Rust CLI with its handler, errors, output and tests. Use when the user asks for a new command, subcommand or option that does work. --- # Add a command `config show` is the worked example: `src/cli.rs` (the `Config` and `ConfigCommand` variants), `src/commands/config.rs` (the handler and its unit tests), the dispatch `match` in `src/app.rs`, and its cases in `tests/cli.rs`. Follow the same path. 1. **Parse.** Add a variant to `Command` in `src/cli.rs` with a `///` doc comment (clap shows it in `--help`). Command-specific arguments go on the variant; a flag every command needs is `global = true` on `Cli`. `Cli::command().debug_assert()` in `cli.rs`'s tests catches conflicting definitions. 2. **Handle.** Create `src/commands/<name>.rs` with `pub fn run(config: &Config, output: Output, out: &mut dyn Write, ...) -> Result<(), AppError>` and declare it in `src/commands.rs`. Write the result once with `output.result(out, &value, &human)`: `value` is a `Serialize` type scripts rely on, `human` the text a person reads. Log with `tracing::debug!`. 3. **Dispatch.** Add the arm to the `match command` in `app::invoke`. The compiler rejects a missing arm. 4. **Fail.** A new failure is a new `AppError` variant in `src/error.rs` with its `code()`, `suggestion()` and `exit_code()` arms (2 for a mistake in the invocation, 3 for configuration, 1 otherwise). Add the row to the exit-status table in `docs/ARCHITECTURE.md`. 5. **Settings.** A new setting goes in `Config`, its `Default`, the file `Layer` and `env_layer` in `src/config.rs`, `validate` if it can be wrong, a precedence test, and a row in `docs/configuration.md`. 6. **Test.** Unit tests beside the handler for both output modes. In `tests/cli.rs`, a success case and one case per failure, each checking the exit status, stdout and stderr in human and `--json` mode. 7. Run `make lint test`, then `make smoke`.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · steamfield/stacks | 96 | Apache-2.0 |
| todoist/todoist-cli | 100 | MIT |
| proteanhq/protean | 100 | Apache-2.0 |
| doist/todoist-cli | 100 | MIT |
| coralogix/cx-cli | 100 | Apache-2.0 |
| GO-VIRTUAL-bv/tile38.go | 100 | MPL-2.0 |
| steamfield/stacks | 96 | Apache-2.0 |
| ldayton/dippy | 95 | MIT |
| steamfield/stacks | 86 | Apache-2.0 |
Migawka bazy z 13.11.2026 · wersja paczki ba0aa3f4e2f6 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100add-cli-command
Dodaje lub zmienia polecenie CLI, flagę albo format wyjścia zgodnie z konwencjami repozytorium dla argumentów, kodów wyjścia, JSON, pomocy i testów. - 100add-tauri-command
Dodaje polecenie Tauri do MooshieUI od początku do końca: handler w Rust, rejestrację w lib.rs i opakowanie ipcInvoke w TypeScript. - 100n8nac-reference
Opisuje każde polecenie, podpolecenie i flagę CLI n8nac w wersji 2.7.0, żeby nie zgadywać flag ani nie wymyślać nieistniejących poleceń. - 100add-cli-option
Dodaje nową opcję CLI lub konfiguracji Remotion: tworzy AnyRemotionOption, rejestruje parsowanie, podpina settery i aktualizuje dokumentację. - 95rs-domain-cli
Pomaga pisać narzędzia wiersza poleceń w Rust: parsowanie argumentów, podpolecenia, TUI, paski postępu i pliki konfiguracji. - 100run-cq
Buduje, uruchamia i testuje cq, CLI do zapytań SQL nad transkryptami Claude Code, napisane w Rust z DuckDB.