You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a CLI with subcommands and I'd like to have the default command with no args display the help message. What is the best way to achieve that?
Currently I get the following parse error
Failed to parse command""
defmoduleBos.CLIdouseNexusdefcommand(:broker,type: :null,doc: "broker subcommands.")dodefcommand(:start,default: "",doc: "start a broker in the foreground.")defcommand(:stop,default: "",doc: "stop a running broker.")end@implNexus.CLIdefversion,do: "0.0.1"@implNexus.CLIdefbanner,do: "universal cli for bos"@implNexus.CLIdefhandle_input(:broker,%{value: value,subcommand: :start})doIO.puts("TODO 'broker start'")IO.inspect(value,label: :value):okenddefhandle_input(:broker,%{value: value,subcommand: :stop})doIO.puts("TODO 'broker stop'")IO.inspect(value,label: :value)System.halt(0):okenddefhandle_input(:broker,args)doIO.puts("TODO 'broker catch all'")IO.inspect(args,label: :args)System.halt(0):okend@implNexus.CLIdefhandle_input(:help)doIO.puts(Nexus.help(__MODULE__))System.halt(0):okenddefhandle_input(catch_all)doIO.puts("CATCH all/1: #{inspect(catch_all)}")System.halt(0):okendNexus.help()Nexus.parse()end
The text was updated successfully, but these errors were encountered:
I'm trying to write a CLI with subcommands and I'd like to have the default command with no args display the help message. What is the best way to achieve that?
Currently I get the following parse error
The text was updated successfully, but these errors were encountered: