Skip to content

Commit 5a7cee4

Browse files
Make aliases work again Closes: #93 (#114)
* Make aliases work again Closes: #93 * show usage when args are insufficient * Update lib/twurl/cli.rb Co-Authored-By: Shohei Maeda <[email protected]>
1 parent ded1136 commit 5a7cee4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/twurl/cli.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ def dispatch(options)
4141
end
4242

4343
def parse_options(args)
44-
arguments = args.dup
45-
4644
Twurl.options = Options.new
47-
Twurl.options.args = arguments
45+
Twurl.options.args = args.dup
4846
Twurl.options.trace = false
4947
Twurl.options.data = {}
5048
Twurl.options.headers = {}
@@ -97,13 +95,13 @@ def parse_options(args)
9795
arguments = option_parser.parse!(args)
9896
Twurl.options.command = extract_command!(arguments)
9997
Twurl.options.path = extract_path!(arguments)
100-
101-
if Twurl.options.command == DEFAULT_COMMAND and Twurl.options.path.nil?
98+
Twurl.options.subcommands = arguments
99+
100+
if Twurl.options.command == DEFAULT_COMMAND and Twurl.options.path.nil? and Twurl.options.args.empty?
102101
CLI.puts option_parser
103102
raise NoPathFound, "No path found"
104103
end
105104

106-
Twurl.options.subcommands = arguments
107105
Twurl.options
108106
end
109107

0 commit comments

Comments
 (0)