diff --git a/exe/lc.sh b/exe/lc.sh index 9e9e1d0..0df3823 100755 --- a/exe/lc.sh +++ b/exe/lc.sh @@ -1,2 +1,12 @@ #!/usr/bin/env bash -exec linear-cli issue list "$@" +if [ "$#" -eq 0 ]; then + printf "No subcommand provided, defaulting to 'lc issue list'\nlc --help to see subcommands\n" >&2 + exec linear-cli issue list +fi +if [[ "$*" =~ --help|-h ]] +then + printf "Each subcommand has its own help, use 'lc --help' to see it\n" >&2 + linear-cli "$@" 2>&1|sed 's/linear-cli/lc/g' + exit 0 +fi +exec linear-cli "$@" diff --git a/lib/linear/cli.rb b/lib/linear/cli.rb index 2afb648..78288b5 100644 --- a/lib/linear/cli.rb +++ b/lib/linear/cli.rb @@ -37,12 +37,10 @@ def self.register_subcommands!(command, name, klass) end end - def self.load_and_register!(command, description: nil) - description ||= command::DESCRIPTION - logger.debug "Registering #{command} #{description}" + def self.load_and_register!(command) name = command.name.split('::').last.downcase command_aliases = command::ALIASES[name.to_sym] || [] - register name, description:, aliases: Array(command_aliases) do |cmd| + register name, aliases: Array(command_aliases) do |cmd| register_subcommands! cmd, name, command end end diff --git a/lib/linear/commands/issue/update.rb b/lib/linear/commands/issue/update.rb index bd03b35..d4f5609 100644 --- a/lib/linear/commands/issue/update.rb +++ b/lib/linear/commands/issue/update.rb @@ -19,10 +19,10 @@ class Update include Rubyists::Linear::CLI::Issue # for #gimme_da_issue! and other Issue methods desc 'Update an issue' argument :issue_ids, type: :array, required: true, desc: 'Issue IDs (i.e. ISS-1)' - option :comment, type: :string, aliases: ['--message'], desc: 'Comment to add to the issue' + option :comment, type: :string, aliases: ['-m'], desc: 'Comment to add to the issue' option :pr, type: :boolean, aliases: ['--pull-request'], default: false, desc: 'Create a pull request' option :close, type: :boolean, default: false, desc: 'Close the issue' - option :reason, type: :string, aliases: ['--close-reason'], desc: 'Reason for closing the issue' + option :reason, type: :string, aliases: ['--butwhy'], desc: 'Reason for closing the issue' def call(issue_ids:, **options) logger.debug('Updating issues', issue_ids:, options:)