feat: Organize subcommands
This commit is contained in:
parent
70eb0c6f56
commit
27d11e266e
1 changed files with 68 additions and 40 deletions
|
@ -16,50 +16,15 @@ module AutoBoard
|
|||
parser = OptionParser.new do |opts|
|
||||
opts.banner = "Usage: autoboard [options]"
|
||||
|
||||
opts.on("-t", "--template TEMPLATE_NAME", "Create or manage templates") do |template_name|
|
||||
@options[:template] = template_name
|
||||
end
|
||||
|
||||
opts.on("-b", "--board BOARD_ID", "Create or manage boards") do |board_id|
|
||||
@options[:board] = board_id
|
||||
end
|
||||
opts.on("board", "Manage boards", &board_parser(opts))
|
||||
opts.on("host", "Manage hosts", &host_parser(opts))
|
||||
opts.on("template", "Manage templates", &template_parser(opts))
|
||||
opts.on("workspace", "Manage workspaces", &workspace_parser(opts))
|
||||
|
||||
opts.on("-p", "--project PROJECT_ID", "Choose a project for the board") do |project_id|
|
||||
@options[:project] = project_id
|
||||
end
|
||||
|
||||
opts.on("-n", "--name LIST_NAME", "Name of the list") do |list_name|
|
||||
@options[:list_name] = list_name
|
||||
end
|
||||
|
||||
opts.on("-l", "--label LABEL_NAME", "Name of the label") do |label_name|
|
||||
@options[:label_name] = label_name
|
||||
end
|
||||
|
||||
opts.on("-c", "--create", "Create a new template or board") do
|
||||
@options[:create] = true
|
||||
end
|
||||
|
||||
opts.on("-a", "--addlist", "Add a new list to the template") do
|
||||
@options[:addlist] = true
|
||||
end
|
||||
|
||||
opts.on("-r", "--rmlist", "Remove a list from the template") do
|
||||
@options[:rmlist] = true
|
||||
end
|
||||
|
||||
opts.on("-d", "--destroy", "Destroy a template or board") do
|
||||
@options[:destroy] = true
|
||||
end
|
||||
|
||||
opts.on("-i", "--inspect", "Inspect a template or board") do
|
||||
@options[:inspect] = true
|
||||
end
|
||||
|
||||
opts.on("-l", "--ls", "List templates or boards") do
|
||||
@options[:ls] = true
|
||||
end
|
||||
|
||||
opts.on("-h", "--help", "Show this help") do
|
||||
puts opts
|
||||
exit
|
||||
|
@ -68,7 +33,70 @@ module AutoBoard
|
|||
end
|
||||
end
|
||||
|
||||
def template_parser
|
||||
def workspace_parser(opts : OptionParser)
|
||||
->(value : String) do
|
||||
opts.banner = "Usage: autoboard workspace [options]"
|
||||
end
|
||||
end
|
||||
|
||||
def host_parser(opts : OptionParser)
|
||||
->(value : String) do
|
||||
opts.banner = "Usage: autoboard host [options]"
|
||||
end
|
||||
end
|
||||
|
||||
def board_parser(opts : OptionParser)
|
||||
->(value : String) do
|
||||
opts.banner = "Usage: autoboard board [options]"
|
||||
end
|
||||
end
|
||||
|
||||
def template_column_parser(opts : OptionParser)
|
||||
->(value : String) do
|
||||
opts.on("create", "Add a new list to the template") do
|
||||
opts.on("--label LABEL_ID", "Assign label LABEL_ID to the list") do |label_name|
|
||||
@options[:label_name] = label_name
|
||||
end
|
||||
|
||||
opts.on("--open", "Assign open tasks to the list") do |label_name|
|
||||
end
|
||||
|
||||
opts.on("--closed", "Assign closed tasks to the list") do |label_name|
|
||||
end
|
||||
end
|
||||
|
||||
opts.on("destroy", "Remove a list from the template") do
|
||||
end
|
||||
|
||||
opts.on("-c", "--column LIST_ID", "ID of the column") do |column_id|
|
||||
@options[:column_id] = column_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def template_parser(opts : OptionParser)
|
||||
->(value : String) do
|
||||
opts.banner = "Usage: autoboard template [options]"
|
||||
|
||||
opts.on("create", "Create a new template") do
|
||||
end
|
||||
|
||||
opts.on("column", "Manage templates columns", &template_column_parser(opts))
|
||||
|
||||
opts.on("list", "List templates") do
|
||||
end
|
||||
|
||||
opts.on("inspect", "Inspect a template") do
|
||||
end
|
||||
|
||||
opts.on("destroy", "Destroy a new template") do
|
||||
end
|
||||
|
||||
opts.on("-t", "--template TEMPLATE_ID", "ID of the template") do |template_id|
|
||||
@options[:template_id] = template_id
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue