flipt-io / cup

Git Contribution Automation
https://cup.flipt.io
Apache License 2.0
76 stars 1 forks source link

feat(cmd/cup): adds the new cup CLI #24

Closed GeorgeMac closed 1 year ago

GeorgeMac commented 1 year ago

Fixes #14

This is the first sketch of the cup CLI. Heavily influence by kubectl.

➜  go run cmd/cup/*.go
NAME:
   cup - A new cli application

USAGE:
   cup [global options] command [command options] [arguments...]

COMMANDS:
   config, c  Access the local configuration for the cup CLI.
   ctl        Access the resource API of a cupd instance
   help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --config value, -c value  (default: "/Users/georgemac/Library/Application Support/cup/config.json")
   --help, -h                show help

cup config

This subcommand manages a configuration file which handles storing some of the common search facets when using cup. Primarilly, it stores the context profiles for the cup CLI. The contexts and current context are stored in a JSON file (similar to ~/kube/config) which is stamped out by default when not defined.

The contexts include:

➜  go run cmd/cup/*.go config ctx -h
NAME:
   cup config context

USAGE:
   cup config context command [command options] [arguments...]

COMMANDS:
   set
   help, h  Shows a list of commands or help for one command

OPTIONS:
   --help, -h  show help

cup ctl

➜  go run cmd/cup/*.go ctl
NAME:
   cup ctl - Access the resource API of a cupd instance

USAGE:
   cup ctl command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command
   discovery:
     sources, s      List the available sources
     definitions, d  List the available resource definitions for a target source
   resource:
     list, l  List the available resources of a given definition for the target source

OPTIONS:
   --help, -h  show help

This section of the command handles resource management.