When running Thor in a development environment on a server a code reloader, I noticed the subcommand would register duplicates like this:
tinyzap/server [cli-puma] → bin/tinyzap
Commands:
tinyzap echo # Echos the input from stdin
tinyzap help [COMMAND] # Describe available commands or one specific command
tinyzap links # Manage links
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links list # Lists links
tinyzap links list # Lists links
tinyzap links list # Lists links
tinyzap links list # Lists links
tinyzap links list # Lists links
tinyzap links list # Lists links
tinyzap links list # Lists links
tinyzap login # Login to TinyZap
tinyzap whoami # Prints your current login information
tinyzap/server [cli-puma] →
This PR fixes that problem by checking to see if the command is registered already. If it is, it returns the existing subcommand.
tinyzap/server [cli-puma] → bin/tinyzap
Commands:
tinyzap echo # Echos the input from stdin
tinyzap help [COMMAND] # Describe available commands or one specific command
tinyzap links # Manage links
tinyzap links create -d, --description=DESCRIPTION -t, --title=TITLE # Create a new link
tinyzap links help [COMMAND] # Describe subcommands or one specific subcommand
tinyzap links list # Lists links
tinyzap login # Login to TinyZap
tinyzap whoami # Prints your current login information
When running Thor in a development environment on a server a code reloader, I noticed the subcommand would register duplicates like this:
This PR fixes that problem by checking to see if the command is registered already. If it is, it returns the existing subcommand.