Skip to content

Commit

Permalink
Sanitizes aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
bougyman committed Feb 5, 2024
1 parent 6dea5e3 commit 1593939
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
12 changes: 11 additions & 1 deletion exe/lc.sh
Original file line number Diff line number Diff line change
@@ -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 <subcommand> --help' to see it\n" >&2
linear-cli "$@" 2>&1|sed 's/linear-cli/lc/g'
exit 0
fi
exec linear-cli "$@"
6 changes: 2 additions & 4 deletions lib/linear/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/linear/commands/issue/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:)
Expand Down

0 comments on commit 1593939

Please sign in to comment.