Mach-34 / Grapevine

Like ethdos except degrees of separation from phrase
3 stars 1 forks source link

Refactor: cli args rework #43

Closed jp4g closed 5 months ago

jp4g commented 5 months ago

Commands should be reorganized to have subcommands

Outline:

 grapevine
   | - phrase
   |      | - get <id>: get an existing phrase with info about it known by caller
   |      | - prove <phrase> <description>: proves knowledge of new phrase. Create new with description or prove connection to existing
   |      | - sync: retrieves all new degree proofs caller can make, then iterates and proves new degrees
   |      | - known: returns all known phrases
   |      | - degrees: returns all degrees > 1 for the caller
   | - relationship
   |      | - pending: show all pending relationships
   |      | - reject <username>: if a relationship from <username> is pending for caller, reject it
   |      | - add <username>: if no pending relationship from <username> for caller, send them a request. If pending exists, add them back
   | - account
   |     | - register <username>: registers a new account for the username
   |     | - get: returns info about the account signed in via cli
   | - health: confirms CLI is connected to server and shows the connected URL

Should show help message for commands and subcommands

jp4g commented 5 months ago

Final output:

$ grapevine
   ______                           _           
  / ____/________ _____  ___ _   __(_)___  ___  
 / / __/ ___/ __ `/ __ \/ _ \ | / / / __ \/ _ \
/ /_/ / /  / /_/ / /_/ /  __/ |/ / / / / /  __/
\____/_/   \__,_/ .___/\___/|___/_/_/ /_/\___/  
               /_/

Usage: grapevine <COMMAND>

Commands:
  health        Test the connection to the Grapevine server
                    usage: `grapevine health`
  account       Commands for managing your Grapevine account
  relationship  Commands for managing relationships
  phrase        Commands for interacting with phrases and degree proofs
  help          Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
$ grapevine account
Commands for managing your Grapevine account

Usage: grapevine account <COMMAND>

Commands:
  register  Register a new Grapevine account
                usage: `grapevine account register <username>`
  info      Get information about your Grapevine account
                usage: `grapevine account info`
  export    Export the Baby JubJub private key for your account
                usage: `grapevine account export`
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
$ grapevine relationship
Commands for managing relationships

Usage: grapevine relationship <COMMAND>

Commands:
  add      Send a new relationship request or accept a pending request
               usage: `grapevine relationship add <username>`
  pending  Show pending relationship requests from other users
               usage: `grapevine relationship pending`
  reject   Reject a pending relationship request
               usage: `grapevine relationship reject <username>`
  list     List the username of all of your active relationships
               usage: `grapevine relationship list`
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version
$ grapevine phrase
Commands for interacting with phrases and degree proofs

Usage: grapevine phrase <COMMAND>

Commands:
  prove    Prove knowledge of a phrase. Description is discarded if the phrase already exists
               usage: `grapevine phrase prove "<phrase>" "<description>"`
  sync     Check for new degree proofs from relationships and build degrees on top of them
               usage: `grapevine phrase sync`
  get      Get all information known by this account about a given phrase by its index
               usage: `grapevine phrase get <index>`
  known    Return all phrases known by this account (degree 1)
               usage: `grapevine phrase known`
  degrees  Return all degree proofs created by this account (degree > 1)
               usage: `grapevine phrase degrees`
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version