Add example specs: simple.json and my-cli.yaml
This commit is contained in:
78
examples/my-cli.yaml
Normal file
78
examples/my-cli.yaml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
name: my-cli
|
||||||
|
version: 1.0.0
|
||||||
|
description: A sample CLI tool for demonstration
|
||||||
|
author: John Doe
|
||||||
|
license: MIT
|
||||||
|
bin: my-cli
|
||||||
|
|
||||||
|
globalOptions:
|
||||||
|
- name: verbose
|
||||||
|
short: v
|
||||||
|
description: Enable verbose output
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
- name: config
|
||||||
|
short: c
|
||||||
|
description: Path to configuration file
|
||||||
|
type: string
|
||||||
|
default: "~/.my-clirc"
|
||||||
|
|
||||||
|
commands:
|
||||||
|
- name: start
|
||||||
|
description: Start the service
|
||||||
|
aliases: [run, begin]
|
||||||
|
options:
|
||||||
|
- name: port
|
||||||
|
short: p
|
||||||
|
description: Port number to listen on
|
||||||
|
type: number
|
||||||
|
default: 8080
|
||||||
|
- name: host
|
||||||
|
short: h
|
||||||
|
description: Host address to bind to
|
||||||
|
type: string
|
||||||
|
default: "localhost"
|
||||||
|
arguments:
|
||||||
|
- name: service
|
||||||
|
description: Name of the service to start
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- name: stop
|
||||||
|
description: Stop a running service
|
||||||
|
options:
|
||||||
|
- name: force
|
||||||
|
short: f
|
||||||
|
description: Force stop without cleanup
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
- name: config
|
||||||
|
description: Manage configuration
|
||||||
|
aliases: [cfg, conf]
|
||||||
|
subcommands:
|
||||||
|
- name: show
|
||||||
|
description: Display current configuration
|
||||||
|
options:
|
||||||
|
- name: format
|
||||||
|
short: f
|
||||||
|
description: Output format (json, yaml)
|
||||||
|
type: string
|
||||||
|
default: "yaml"
|
||||||
|
- name: set
|
||||||
|
description: Set a configuration value
|
||||||
|
arguments:
|
||||||
|
- name: key
|
||||||
|
description: Configuration key
|
||||||
|
required: true
|
||||||
|
- name: value
|
||||||
|
description: Configuration value
|
||||||
|
required: true
|
||||||
|
|
||||||
|
examples:
|
||||||
|
- description: Start a service on port 3000
|
||||||
|
command: "my-cli start --port 3000 api-server"
|
||||||
|
output: "Starting api-server on port 3000..."
|
||||||
|
|
||||||
|
- description: Show current configuration in JSON format
|
||||||
|
command: "my-cli config show --format json"
|
||||||
|
output: "{\"port\": 8080, \"host\": \"localhost\"}"
|
||||||
Reference in New Issue
Block a user