Skip to content

Commit 3332d86

Browse files
committed
Move username check to methods that require usernames
* We're introducing a "list" method which requires no username argument
1 parent e0cfd3a commit 3332d86

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/github/auth/cli.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def initialize(argv)
1111
end
1212

1313
def execute
14-
if COMMANDS.include?(command) && !usernames.empty?
14+
if COMMANDS.include?(command)
1515
send command
1616
elsif command == '--version'
1717
print_version
@@ -23,11 +23,21 @@ def execute
2323
private
2424

2525
def add
26+
if usernames.empty?
27+
print_usage
28+
return
29+
end
30+
2631
on_keys_file :write!,
2732
"Adding #{keys.count} key(s) to '#{keys_file.path}'"
2833
end
2934

3035
def remove
36+
if usernames.empty?
37+
print_usage
38+
return
39+
end
40+
3141
on_keys_file :delete!,
3242
"Removing #{keys.count} key(s) from '#{keys_file.path}'"
3343
end

0 commit comments

Comments
 (0)