feat: completion + README — polish and docs
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# ry — Multi-Cloud CLI
|
||||
|
||||
A `gh`-style CLI for managing cloud resources across providers.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
go install git.yoresee.cc/nightstar/ry/cmd/ry@latest
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
ry provider add rainyun
|
||||
# Enter your API key when prompted
|
||||
|
||||
ry server list
|
||||
ry server start <id>
|
||||
ry server vnc <id>
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
- `ry provider` — manage cloud providers (add, use, list)
|
||||
- `ry server` — manage cloud servers (list, get, start, stop, reboot, reinstall, reset-password, vnc)
|
||||
- `ry domain` — manage domains and DNS records
|
||||
- `ry storage` — manage object storage and buckets
|
||||
- `ry billing` — view orders
|
||||
- `ry config` — manage configuration (show, set, path)
|
||||
- `ry completion` — shell completion for bash/zsh/fish
|
||||
|
||||
## Global Flags
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-p, --provider` | Override cloud provider |
|
||||
| `-o, --output` | Output format: table, json, yaml |
|
||||
| `--raw` | Raw API response |
|
||||
| `--debug` | Debug output |
|
||||
|
||||
## Supported Providers
|
||||
|
||||
- **雨云 (Rainyun)** — full support
|
||||
- More coming soon
|
||||
|
||||
## Config
|
||||
|
||||
`~/.config/ry/config.toml`
|
||||
@@ -88,4 +88,24 @@ func init() {
|
||||
rootCmd.PersistentFlags().StringVarP(&flagOutput, "output", "o", "", "Output format: table, json, yaml, raw")
|
||||
rootCmd.PersistentFlags().BoolVar(&flagRaw, "raw", false, "Output raw API response")
|
||||
rootCmd.PersistentFlags().BoolVar(&flagDebug, "debug", false, "Enable debug output")
|
||||
|
||||
completionCmd := &cobra.Command{
|
||||
Use: "completion [bash|zsh|fish]",
|
||||
Short: "Generate shell completion script",
|
||||
Annotations: map[string]string{"skipProvider": "true"},
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
switch args[0] {
|
||||
case "bash":
|
||||
return rootCmd.GenBashCompletion(os.Stdout)
|
||||
case "zsh":
|
||||
return rootCmd.GenZshCompletion(os.Stdout)
|
||||
case "fish":
|
||||
return rootCmd.GenFishCompletion(os.Stdout, true)
|
||||
default:
|
||||
return fmt.Errorf("unsupported shell: %s", args[0])
|
||||
}
|
||||
},
|
||||
}
|
||||
rootCmd.AddCommand(completionCmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user