gli 2.17.2 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/gli +41 -38
- data/features/gli_init.feature +2 -0
- data/gli.rdoc +42 -4
- data/lib/gli.rb +1 -0
- data/lib/gli/commands/rdoc_document_listener.rb +1 -0
- data/lib/gli/commands/scaffold.rb +50 -48
- data/lib/gli/version.rb +1 -1
- data/test/apps/todo/bin/todo +5 -5
- data/test/apps/todo/lib/todo/commands/create.rb +42 -41
- data/test/apps/todo/lib/todo/commands/list.rb +43 -42
- data/test/apps/todo/lib/todo/commands/ls.rb +25 -24
- data/test/apps/todo/lib/todo/commands/make.rb +42 -40
- data/test/apps/todo_plugins/commands/third.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37750b02cb524b2401b75d1f53722be230486faac88638a06c2722e8aba595bb
|
4
|
+
data.tar.gz: 73964afbb6c60b87be8a7cdd688cc9b54a3624b20ea32cddd1ae3ac5ba75da63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f822477176088b91c87fb1a9902e5e856c32c9904c2e8773d38566ab821f7f612ef18bcfc5a9dd67ae8c8461a6afaed60fa57fe939b0d965f707a4da88980eee
|
7
|
+
data.tar.gz: a68d246f06f74ef758fe75e79f9a7e6cf8a9d8667d71a1dfc2702aa1ce7f5b925a8f433b27ea3171fb1453d5b7a84d8983bb27a93df4c31a10c863f89de39b41
|
data/bin/gli
CHANGED
@@ -3,63 +3,66 @@
|
|
3
3
|
require 'gli'
|
4
4
|
require 'gli/commands/scaffold'
|
5
5
|
|
6
|
-
|
6
|
+
class App
|
7
|
+
extend GLI::App
|
7
8
|
|
8
|
-
program_desc 'create scaffolding for a GLI-powered application'
|
9
|
+
program_desc 'create scaffolding for a GLI-powered application'
|
9
10
|
|
10
|
-
version GLI::VERSION
|
11
|
+
version GLI::VERSION
|
11
12
|
|
12
|
-
# Can't use these without changing the current behavior of gli
|
13
|
-
# arguments :strict
|
14
|
-
# subcommand_option_handling :normal
|
13
|
+
# Can't use these without changing the current behavior of gli
|
14
|
+
# arguments :strict
|
15
|
+
# subcommand_option_handling :normal
|
15
16
|
|
16
|
-
switch :v, :desc => 'Be verbose'
|
17
|
+
switch :v, :desc => 'Be verbose'
|
17
18
|
|
18
|
-
switch :n, :desc => 'Dry run; don''t change the disk'
|
19
|
+
switch :n, :desc => 'Dry run; don''t change the disk'
|
19
20
|
|
20
|
-
desc 'Root dir of project'
|
21
|
+
desc 'Root dir of project'
|
21
22
|
long_desc <<EOS
|
22
|
-
This is the directory where the project''s directory will be made, so if you
|
23
|
-
specify a project name ''foo'' and the root dir of ''.'', the directory
|
24
|
-
''./foo'' will be created'
|
23
|
+
This is the directory where the project''s directory will be made, so if you
|
24
|
+
specify a project name ''foo'' and the root dir of ''.'', the directory
|
25
|
+
''./foo'' will be created'
|
25
26
|
EOS
|
26
27
|
|
27
|
-
flag :r,:root, :default_value => '.'
|
28
|
+
flag :r,:root, :default_value => '.'
|
28
29
|
|
29
|
-
desc 'Create a new GLI-based project'
|
30
|
+
desc 'Create a new GLI-based project'
|
30
31
|
long_desc <<EOS
|
31
|
-
This will create a scaffold command line project that uses GLI
|
32
|
-
for command line processing. Specifically, this will create
|
33
|
-
an executable ready to go, as well as a lib and test directory, all
|
34
|
-
inside the directory named for your project
|
32
|
+
This will create a scaffold command line project that uses GLI
|
33
|
+
for command line processing. Specifically, this will create
|
34
|
+
an executable ready to go, as well as a lib and test directory, all
|
35
|
+
inside the directory named for your project
|
35
36
|
EOS
|
36
|
-
arg :project_name
|
37
|
-
arg :command_name, [:optional, :multiple]
|
38
|
-
arg_name "project_name [command_name][, [command_name]]*"
|
39
|
-
command [:init,:scaffold] do |c|
|
37
|
+
arg :project_name
|
38
|
+
arg :command_name, [:optional, :multiple]
|
39
|
+
arg_name "project_name [command_name][, [command_name]]*"
|
40
|
+
command [:init,:scaffold] do |c|
|
40
41
|
|
41
|
-
|
42
|
+
c.switch :e,:ext, :desc => 'Create an ext dir'
|
42
43
|
|
43
|
-
|
44
|
+
c.switch :notest, :desc => 'Do not create a test or features dir', :negatable => false
|
44
45
|
|
45
|
-
|
46
|
+
c.switch :force, :desc => 'Overwrite/ignore existing files and directories'
|
46
47
|
|
47
|
-
|
48
|
+
c.switch :rvmrc, :desc => 'Create an .rvmrc based on your current RVM setup'
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
c.action do |g,o,args|
|
51
|
+
if args.length < 1
|
52
|
+
raise 'You must specify the name of your project'
|
53
|
+
end
|
54
|
+
GLI::Commands::Scaffold.create_scaffold(g[:r],!o[:notest],o[:e],args[0],args[1..-1],o[:force],g[:n],o[:rvmrc])
|
52
55
|
end
|
53
|
-
GLI::Commands::Scaffold.create_scaffold(g[:r],!o[:notest],o[:e],args[0],args[1..-1],o[:force],g[:n],o[:rvmrc])
|
54
56
|
end
|
55
|
-
end
|
56
57
|
|
57
|
-
pre do |global,command,options,args|
|
58
|
-
|
59
|
-
|
60
|
-
end
|
58
|
+
pre do |global,command,options,args|
|
59
|
+
puts "Executing #{command.name}" if global[:v]
|
60
|
+
true
|
61
|
+
end
|
61
62
|
|
62
|
-
post do |global,command,options,args|
|
63
|
-
|
63
|
+
post do |global,command,options,args|
|
64
|
+
puts "Executed #{command.name}" if global[:v]
|
65
|
+
end
|
64
66
|
end
|
65
|
-
|
67
|
+
|
68
|
+
exit App.run(ARGV)
|
data/features/gli_init.feature
CHANGED
@@ -47,6 +47,8 @@ Feature: The scaffold GLI generates works
|
|
47
47
|
|todo/lib/todo/version.rb |
|
48
48
|
|todo/lib/todo.rb |
|
49
49
|
|todo/.rvmrc |
|
50
|
+
And the file "todo/README.rdoc" should contain ":include:todo.rdoc"
|
51
|
+
And the file "todo/todo.rdoc" should contain "todo _doc"
|
50
52
|
When I cd to "todo"
|
51
53
|
And I make sure todo's lib dir is in my lib path
|
52
54
|
And I run `bin/todo`
|
data/gli.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== gli - create scaffolding for a GLI-powered application
|
2
2
|
|
3
|
-
v2.
|
3
|
+
v2.17.1
|
4
4
|
|
5
5
|
=== Global Options
|
6
6
|
=== -r|--root arg
|
@@ -8,9 +8,9 @@ v2.12.1
|
|
8
8
|
Root dir of project
|
9
9
|
|
10
10
|
[Default Value] .
|
11
|
-
This is the directory where the project''s directory will be made, so if you
|
12
|
-
specify a project name ''foo'' and the root dir of ''.'', the directory
|
13
|
-
''./foo'' will be created'
|
11
|
+
This is the directory where the project''s directory will be made, so if you
|
12
|
+
specify a project name ''foo'' and the root dir of ''.'', the directory
|
13
|
+
''./foo'' will be created'
|
14
14
|
|
15
15
|
=== --help
|
16
16
|
Show this message
|
@@ -33,3 +33,41 @@ Display the program version
|
|
33
33
|
|
34
34
|
|
35
35
|
=== Commands
|
36
|
+
==== Command: <tt>help command</tt>
|
37
|
+
Shows a list of commands or help for one command
|
38
|
+
|
39
|
+
Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function
|
40
|
+
===== Options
|
41
|
+
===== -c
|
42
|
+
List commands one per line, to assist with shell completion
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
==== Command: <tt>init|scaffold project_name [command_name][, [command_name]]*</tt>
|
47
|
+
Create a new GLI-based project
|
48
|
+
|
49
|
+
This will create a scaffold command line project that uses GLI
|
50
|
+
for command line processing. Specifically, this will create
|
51
|
+
an executable ready to go, as well as a lib and test directory, all
|
52
|
+
inside the directory named for your project
|
53
|
+
===== Options
|
54
|
+
===== -e|--[no-]ext
|
55
|
+
Create an ext dir
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
===== --[no-]force
|
60
|
+
Overwrite/ignore existing files and directories
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
===== --notest
|
65
|
+
Do not create a test or features dir
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
===== --[no-]rvmrc
|
70
|
+
Create an .rvmrc based on your current RVM setup
|
71
|
+
|
72
|
+
|
73
|
+
|
data/lib/gli.rb
CHANGED
@@ -44,7 +44,7 @@ module GLI
|
|
44
44
|
puts "Created #{root_dir}/#{project_name}/README.rdoc"
|
45
45
|
File.open("#{root_dir}/#{project_name}/#{project_name}.rdoc",'w') do |file|
|
46
46
|
file << "= #{project_name}\n\n"
|
47
|
-
file << "Generate this with\n #{project_name}
|
47
|
+
file << "Generate this with\n #{project_name} _doc\nAfter you have described your command line interface"
|
48
48
|
end
|
49
49
|
puts "Created #{root_dir}/#{project_name}/#{project_name}.rdoc"
|
50
50
|
end
|
@@ -277,85 +277,87 @@ rescue LoadError
|
|
277
277
|
exit 64
|
278
278
|
end
|
279
279
|
|
280
|
-
|
280
|
+
class App
|
281
|
+
extend GLI::App
|
281
282
|
|
282
|
-
program_desc 'Describe your application here'
|
283
|
+
program_desc 'Describe your application here'
|
283
284
|
|
284
|
-
version #{project_name_as_module_name(project_name)}::VERSION
|
285
|
+
version #{project_name_as_module_name(project_name)}::VERSION
|
285
286
|
|
286
|
-
subcommand_option_handling :normal
|
287
|
-
arguments :strict
|
287
|
+
subcommand_option_handling :normal
|
288
|
+
arguments :strict
|
288
289
|
|
289
|
-
desc 'Describe some switch here'
|
290
|
-
switch [:s,:switch]
|
290
|
+
desc 'Describe some switch here'
|
291
|
+
switch [:s,:switch]
|
291
292
|
|
292
|
-
desc 'Describe some flag here'
|
293
|
-
default_value 'the default'
|
294
|
-
arg_name 'The name of the argument'
|
295
|
-
flag [:f,:flagname]
|
293
|
+
desc 'Describe some flag here'
|
294
|
+
default_value 'the default'
|
295
|
+
arg_name 'The name of the argument'
|
296
|
+
flag [:f,:flagname]
|
296
297
|
EOS
|
297
298
|
first = true
|
298
299
|
commands.each do |command|
|
299
300
|
file.puts <<EOS
|
300
301
|
|
301
|
-
desc 'Describe #{command} here'
|
302
|
-
arg_name 'Describe arguments to #{command} here'
|
302
|
+
desc 'Describe #{command} here'
|
303
|
+
arg_name 'Describe arguments to #{command} here'
|
303
304
|
EOS
|
304
305
|
if first
|
305
306
|
file.puts <<EOS
|
306
|
-
command :#{command} do |c|
|
307
|
-
|
308
|
-
|
307
|
+
command :#{command} do |c|
|
308
|
+
c.desc 'Describe a switch to #{command}'
|
309
|
+
c.switch :s
|
309
310
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
311
|
+
c.desc 'Describe a flag to #{command}'
|
312
|
+
c.default_value 'default'
|
313
|
+
c.flag :f
|
314
|
+
c.action do |global_options,options,args|
|
314
315
|
|
315
|
-
|
316
|
+
# Your command logic here
|
316
317
|
|
317
|
-
|
318
|
-
|
318
|
+
# If you have any errors, just raise them
|
319
|
+
# raise "that command made no sense"
|
319
320
|
|
320
|
-
|
321
|
+
puts "#{command} command ran"
|
322
|
+
end
|
321
323
|
end
|
322
|
-
end
|
323
324
|
EOS
|
324
325
|
else
|
325
326
|
file.puts <<EOS
|
326
|
-
command :#{command} do |c|
|
327
|
-
|
328
|
-
|
327
|
+
command :#{command} do |c|
|
328
|
+
c.action do |global_options,options,args|
|
329
|
+
puts "#{command} command ran"
|
330
|
+
end
|
329
331
|
end
|
330
|
-
end
|
331
332
|
EOS
|
332
333
|
end
|
333
334
|
first = false
|
334
335
|
end
|
335
336
|
file.puts <<EOS
|
336
337
|
|
337
|
-
pre do |global,command,options,args|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
end
|
338
|
+
pre do |global,command,options,args|
|
339
|
+
# Pre logic here
|
340
|
+
# Return true to proceed; false to abort and not call the
|
341
|
+
# chosen command
|
342
|
+
# Use skips_pre before a command to skip this block
|
343
|
+
# on that command only
|
344
|
+
true
|
345
|
+
end
|
345
346
|
|
346
|
-
post do |global,command,options,args|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
end
|
347
|
+
post do |global,command,options,args|
|
348
|
+
# Post logic here
|
349
|
+
# Use skips_post before a command to skip this
|
350
|
+
# block on that command only
|
351
|
+
end
|
351
352
|
|
352
|
-
on_error do |exception|
|
353
|
-
|
354
|
-
|
355
|
-
|
353
|
+
on_error do |exception|
|
354
|
+
# Error logic here
|
355
|
+
# return false to skip default error handling
|
356
|
+
true
|
357
|
+
end
|
356
358
|
end
|
357
359
|
|
358
|
-
exit run(ARGV)
|
360
|
+
exit App.run(ARGV)
|
359
361
|
EOS
|
360
362
|
puts "Created #{bin_file}"
|
361
363
|
end
|
data/lib/gli/version.rb
CHANGED
data/test/apps/todo/bin/todo
CHANGED
@@ -7,11 +7,11 @@ $: << File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
|
|
7
7
|
require 'gli'
|
8
8
|
require 'todo/version'
|
9
9
|
|
10
|
-
|
10
|
+
class App
|
11
11
|
if ENV['GLI1_COMPATIBILITY']
|
12
|
-
|
12
|
+
extend GLI
|
13
13
|
else
|
14
|
-
|
14
|
+
extend GLI::App
|
15
15
|
end
|
16
16
|
|
17
17
|
sort_help (ENV['TODO_SORT_HELP'] || 'alpha').to_sym
|
@@ -70,5 +70,5 @@ on_error do |exception|
|
|
70
70
|
# return false to skip default error handling
|
71
71
|
true
|
72
72
|
end
|
73
|
-
|
74
|
-
exit run(ARGV)
|
73
|
+
end
|
74
|
+
exit App.run(ARGV)
|
@@ -1,53 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
class App
|
2
|
+
desc "Create a new task or context"
|
3
|
+
command [:create,:new] do |c|
|
4
|
+
c.desc "Make a new task"
|
5
|
+
c.arg_name 'task_name', :multiple
|
6
|
+
c.arg :should_ignore_this
|
7
|
+
c.command :tasks do |tasks|
|
8
|
+
tasks.action do |global,options,args|
|
9
|
+
puts "#{args}"
|
10
|
+
end
|
9
11
|
end
|
10
|
-
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
c.desc "Make a new context"
|
14
|
+
c.arg :should_ignore_this
|
15
|
+
c.arg_name 'context_name', :optional
|
16
|
+
c.command :contexts do |contexts|
|
17
|
+
contexts.action do |global,options,args|
|
18
|
+
puts "#{args}"
|
19
|
+
end
|
18
20
|
end
|
19
|
-
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
c.default_desc "Makes a new task"
|
23
|
+
c.action do
|
24
|
+
puts "default action"
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
c.arg "first"
|
28
|
+
c.arg "second"
|
29
|
+
c.arg "name", :optional
|
30
|
+
c.command :"relation_1-1" do |remote|
|
31
|
+
remote.action do |global,options,args|
|
32
|
+
puts "relation: #{args}"
|
33
|
+
end
|
32
34
|
end
|
33
|
-
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
c.arg "first", :multiple
|
37
|
+
c.arg "second"
|
38
|
+
c.arg "name", :optional
|
39
|
+
c.command :"relation_n-1" do |remote|
|
40
|
+
remote.action do |global,options,args|
|
41
|
+
puts "relation: #{args}"
|
42
|
+
end
|
41
43
|
end
|
42
|
-
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
c.arg "first"
|
46
|
+
c.arg "second", :multiple
|
47
|
+
c.arg "name", :optional
|
48
|
+
c.command :"relation_1-n" do |remote|
|
49
|
+
remote.action do |global,options,args|
|
50
|
+
puts "relation: #{args}"
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
53
|
-
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
class App
|
2
|
+
desc "List things, such as tasks or contexts"
|
3
|
+
long_desc %(
|
3
4
|
List a whole lot of things that you might be keeping track of
|
4
5
|
in your overall todo list.
|
5
6
|
|
@@ -9,69 +10,69 @@ long_desc %(
|
|
9
10
|
your todo databases.
|
10
11
|
)
|
11
12
|
|
12
|
-
command [:list] do |c|
|
13
|
-
|
13
|
+
command [:list] do |c|
|
14
|
+
c.default_command :tasks
|
14
15
|
|
15
|
-
|
16
|
-
|
16
|
+
c.desc "Show long form"
|
17
|
+
c.switch [:l,:long]
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
c.flag :required_flag, :required => true
|
20
|
+
c.flag :required_flag2, :required => true
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
c.desc "List tasks"
|
23
|
+
c.long_desc %(
|
23
24
|
Lists all of your tasks that you have, in varying orders, and
|
24
25
|
all that stuff. Yes, this is long, but I need a long description.
|
25
26
|
)
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
c.arg :task, [:optional, :multiple]
|
29
|
+
c.command :tasks do |tasks|
|
30
|
+
tasks.desc "blah blah crud x whatever"
|
31
|
+
tasks.flag [:x], :must_match => Array
|
31
32
|
|
32
|
-
|
33
|
+
tasks.flag :flag
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
tasks.action do |global,options,args|
|
36
|
+
puts options[:x].inspect
|
37
|
+
puts "list tasks: #{args.join(',')}"
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
tasks.desc 'list open tasks'
|
41
|
+
tasks.command :open do |open|
|
42
|
+
open.desc "blah blah crud x whatever"
|
43
|
+
open.flag [:x], :must_match => Array
|
43
44
|
|
44
|
-
|
45
|
+
open.flag :flag
|
45
46
|
|
46
|
-
|
47
|
-
|
47
|
+
open.example "todo list tasks open --flag=blah", desc: "example number 1"
|
48
|
+
open.example "todo list tasks open -x foo"
|
48
49
|
|
49
|
-
|
50
|
-
|
50
|
+
open.action do |global,options,args|
|
51
|
+
puts "tasks open"
|
52
|
+
end
|
51
53
|
end
|
52
|
-
end
|
53
54
|
|
54
|
-
|
55
|
-
|
55
|
+
tasks.default_desc 'list all tasks'
|
56
|
+
end
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
c.desc "List contexts"
|
59
|
+
c.long_desc %(
|
59
60
|
Lists all of your contexts, which are places you might be
|
60
61
|
where you can do stuff and all that.
|
61
62
|
)
|
62
|
-
|
63
|
+
c.command :contexts do |contexts|
|
63
64
|
|
64
|
-
|
65
|
-
|
65
|
+
contexts.desc "Foobar"
|
66
|
+
contexts.switch [:f,'foobar']
|
66
67
|
|
67
|
-
|
68
|
-
|
68
|
+
contexts.desc "Blah"
|
69
|
+
contexts.switch [:b]
|
69
70
|
|
70
|
-
|
71
|
+
contexts.flag :otherflag
|
71
72
|
|
72
|
-
|
73
|
-
|
73
|
+
contexts.action do |global,options,args|
|
74
|
+
puts "list contexts: #{args.join(',')}"
|
75
|
+
end
|
74
76
|
end
|
75
77
|
end
|
76
78
|
end
|
77
|
-
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
class App
|
2
|
+
# This is copied so I can have two slightly different versions of the same thing
|
3
|
+
desc "LS things, such as tasks or contexts"
|
4
|
+
long_desc %(
|
4
5
|
List a whole lot of things that you might be keeping track of
|
5
6
|
in your overall todo list.
|
6
7
|
|
@@ -9,39 +10,39 @@ long_desc %(
|
|
9
10
|
stored in
|
10
11
|
your todo databases.
|
11
12
|
)
|
12
|
-
command [:ls] do |c|
|
13
|
-
|
14
|
-
|
13
|
+
command [:ls] do |c|
|
14
|
+
c.desc "Show long form"
|
15
|
+
c.switch [:l,:long]
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
c.desc "List tasks"
|
18
|
+
c.long_desc %(
|
18
19
|
Lists all of your tasks that you have, in varying orders, and
|
19
20
|
all that stuff. Yes, this is long, but I need a long description.
|
20
21
|
)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
c.command :tasks do |tasks|
|
23
|
+
tasks.desc "blah blah crud x whatever"
|
24
|
+
tasks.flag [:x]
|
25
|
+
tasks.action do |global,options,args|
|
26
|
+
puts "ls tasks: #{args.join(',')}"
|
27
|
+
end
|
26
28
|
end
|
27
|
-
end
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
c.desc "List contexts"
|
31
|
+
c.long_desc %(
|
31
32
|
Lists all of your contexts, which are places you might be
|
32
33
|
where you can do stuff and all that.
|
33
34
|
)
|
34
|
-
|
35
|
+
c.command :contexts do |contexts|
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
contexts.desc "Foobar"
|
38
|
+
contexts.switch [:f,'foobar']
|
38
39
|
|
39
|
-
|
40
|
-
|
40
|
+
contexts.desc "Blah"
|
41
|
+
contexts.switch [:b]
|
41
42
|
|
42
|
-
|
43
|
-
|
43
|
+
contexts.action do |global,options,args|
|
44
|
+
puts "ls contexts: #{args.join(',')}"
|
45
|
+
end
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
47
|
-
|
@@ -1,53 +1,55 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
class App
|
2
|
+
command [:make] do |c|
|
3
|
+
c.desc "Show long form"
|
4
|
+
c.flag [:l,:long]
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
c.desc 'make a new task'
|
7
|
+
c.command :task do |task|
|
8
|
+
task.desc 'make the task a long task'
|
9
|
+
task.flag [:l,:long]
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
task.action do |g,o,a|
|
12
|
+
puts 'new task'
|
13
|
+
puts a.join(',')
|
14
|
+
puts o[:long]
|
15
|
+
end
|
16
|
+
|
17
|
+
task.desc 'make a bug'
|
18
|
+
task.arg :argument, [:multiple, :optional]
|
19
|
+
task.command :bug do |bug|
|
20
|
+
bug.desc 'make this bug in the legacy system'
|
21
|
+
bug.flag [:l,:legacy]
|
22
|
+
|
23
|
+
bug.action do |g,o,a|
|
24
|
+
puts 'new task bug'
|
25
|
+
puts a.join(',')
|
26
|
+
# All this .to_s is to make sure 1.8.7/REE don't convert nil to the string "nil"
|
27
|
+
puts o[:legacy].to_s
|
28
|
+
puts o[:long].to_s
|
29
|
+
puts o[:l].to_s
|
30
|
+
puts o[GLI::Command::PARENT][:l].to_s
|
31
|
+
puts o[GLI::Command::PARENT][:long].to_s
|
32
|
+
puts o[GLI::Command::PARENT][:legacy].to_s
|
33
|
+
puts o[GLI::Command::PARENT][GLI::Command::PARENT][:l].to_s
|
34
|
+
puts o[GLI::Command::PARENT][GLI::Command::PARENT][:long].to_s
|
35
|
+
puts o[GLI::Command::PARENT][GLI::Command::PARENT][:legacy].to_s
|
36
|
+
end
|
37
|
+
end
|
14
38
|
end
|
15
39
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
bug.flag [:l,:legacy]
|
40
|
+
c.desc 'make a new context'
|
41
|
+
c.command :context do |context|
|
42
|
+
context.desc 'make the context a local context'
|
43
|
+
context.flag [:l,:local]
|
21
44
|
|
22
|
-
|
23
|
-
puts 'new
|
45
|
+
context.action do |g,o,a|
|
46
|
+
puts 'new context'
|
24
47
|
puts a.join(',')
|
25
|
-
|
26
|
-
puts o[:legacy].to_s
|
48
|
+
puts o[:local].to_s
|
27
49
|
puts o[:long].to_s
|
28
50
|
puts o[:l].to_s
|
29
|
-
puts o[GLI::Command::PARENT][:l].to_s
|
30
|
-
puts o[GLI::Command::PARENT][:long].to_s
|
31
|
-
puts o[GLI::Command::PARENT][:legacy].to_s
|
32
|
-
puts o[GLI::Command::PARENT][GLI::Command::PARENT][:l].to_s
|
33
|
-
puts o[GLI::Command::PARENT][GLI::Command::PARENT][:long].to_s
|
34
|
-
puts o[GLI::Command::PARENT][GLI::Command::PARENT][:legacy].to_s
|
35
51
|
end
|
36
52
|
end
|
37
|
-
end
|
38
|
-
|
39
|
-
c.desc 'make a new context'
|
40
|
-
c.command :context do |context|
|
41
|
-
context.desc 'make the context a local context'
|
42
|
-
context.flag [:l,:local]
|
43
53
|
|
44
|
-
context.action do |g,o,a|
|
45
|
-
puts 'new context'
|
46
|
-
puts a.join(',')
|
47
|
-
puts o[:local].to_s
|
48
|
-
puts o[:long].to_s
|
49
|
-
puts o[:l].to_s
|
50
|
-
end
|
51
54
|
end
|
52
|
-
|
53
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Copeland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08
|
11
|
+
date: 2018-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|