75 lines
1.9 KiB
Crystal
75 lines
1.9 KiB
Crystal
|
|
require "option_parser"
|
|
|
|
module AutoBoard
|
|
class Cli
|
|
def initialize
|
|
@options = {} of Symbol => (String|Bool)
|
|
end
|
|
|
|
def parse_args(args : Array(String))
|
|
self.parser.parse(args)
|
|
@options
|
|
end
|
|
|
|
def parser() : OptionParser
|
|
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("-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
|
|
end
|
|
opts
|
|
end
|
|
end
|
|
|
|
def template_parser
|
|
end
|
|
end
|
|
end
|