gli 2.17.2 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f2ff76f03d4fc53954e649cea392e77f445b9fa0deae621fba59c66c52c27f0
4
- data.tar.gz: f26e176e6967175ea76cf2278a1665cb9332b8f1b425990d11f6313e458cb1fb
3
+ metadata.gz: 37750b02cb524b2401b75d1f53722be230486faac88638a06c2722e8aba595bb
4
+ data.tar.gz: 73964afbb6c60b87be8a7cdd688cc9b54a3624b20ea32cddd1ae3ac5ba75da63
5
5
  SHA512:
6
- metadata.gz: d9895c2424a0e49d6d185fc73ab433e74d9b366d87697e865633713eedbc8abbdd2afc6cfe045e9aa1197fbe4ed41eb883dcde178e615e125a9d3d70056aca2d
7
- data.tar.gz: 1f5b8750936328ac2a175a7d8b9cf89cd050e8710b5b6939425bab405c8e61d7cbd59c7a34645910008440dc7034f7fab7a817553ac0ac85728bbda84e16324d
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
- include GLI::App
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
- c.switch :e,:ext, :desc => 'Create an ext dir'
42
+ c.switch :e,:ext, :desc => 'Create an ext dir'
42
43
 
43
- c.switch :notest, :desc => 'Do not create a test or features dir', :negatable => false
44
+ c.switch :notest, :desc => 'Do not create a test or features dir', :negatable => false
44
45
 
45
- c.switch :force, :desc => 'Overwrite/ignore existing files and directories'
46
+ c.switch :force, :desc => 'Overwrite/ignore existing files and directories'
46
47
 
47
- c.switch :rvmrc, :desc => 'Create an .rvmrc based on your current RVM setup'
48
+ c.switch :rvmrc, :desc => 'Create an .rvmrc based on your current RVM setup'
48
49
 
49
- c.action do |g,o,args|
50
- if args.length < 1
51
- raise 'You must specify the name of your project'
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
- puts "Executing #{command.name}" if global[:v]
59
- true
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
- puts "Executed #{command.name}" if global[:v]
63
+ post do |global,command,options,args|
64
+ puts "Executed #{command.name}" if global[:v]
65
+ end
64
66
  end
65
- exit run(ARGV)
67
+
68
+ exit App.run(ARGV)
@@ -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.12.1
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
@@ -24,6 +24,7 @@ require 'gli/commands/doc'
24
24
 
25
25
  module GLI
26
26
  include GLI::App
27
+
27
28
  def self.included(klass)
28
29
  warn "You should include GLI::App instead"
29
30
  end
@@ -5,6 +5,7 @@ module GLI
5
5
  class RdocDocumentListener
6
6
 
7
7
  def initialize(global_options,options,arguments,app)
8
+ @app = app
8
9
  @io = File.new("#{app.exe_name}.rdoc",'w')
9
10
  @nest = ''
10
11
  @arg_name_formatter = GLI::Commands::HelpModules::ArgNameFormatter.new
@@ -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} rdoc\nAfter you have described your command line interface"
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
- include GLI::App
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
- c.desc 'Describe a switch to #{command}'
308
- c.switch :s
307
+ command :#{command} do |c|
308
+ c.desc 'Describe a switch to #{command}'
309
+ c.switch :s
309
310
 
310
- c.desc 'Describe a flag to #{command}'
311
- c.default_value 'default'
312
- c.flag :f
313
- c.action do |global_options,options,args|
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
- # Your command logic here
316
+ # Your command logic here
316
317
 
317
- # If you have any errors, just raise them
318
- # raise "that command made no sense"
318
+ # If you have any errors, just raise them
319
+ # raise "that command made no sense"
319
320
 
320
- puts "#{command} command ran"
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
- c.action do |global_options,options,args|
328
- puts "#{command} command ran"
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
- # Pre logic here
339
- # Return true to proceed; false to abort and not call the
340
- # chosen command
341
- # Use skips_pre before a command to skip this block
342
- # on that command only
343
- true
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
- # Post logic here
348
- # Use skips_post before a command to skip this
349
- # block on that command only
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
- # Error logic here
354
- # return false to skip default error handling
355
- true
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
@@ -1,5 +1,5 @@
1
1
  module GLI
2
2
  unless const_defined? :VERSION
3
- VERSION = '2.17.2'
3
+ VERSION = '2.18.0'
4
4
  end
5
5
  end
@@ -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
- include GLI
12
+ extend GLI
13
13
  else
14
- include GLI::App
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
- desc "Create a new task or context"
2
- command [:create,:new] do |c|
3
- c.desc "Make a new task"
4
- c.arg_name 'task_name', :multiple
5
- c.arg :should_ignore_this
6
- c.command :tasks do |tasks|
7
- tasks.action do |global,options,args|
8
- puts "#{args}"
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
- c.desc "Make a new context"
13
- c.arg :should_ignore_this
14
- c.arg_name 'context_name', :optional
15
- c.command :contexts do |contexts|
16
- contexts.action do |global,options,args|
17
- puts "#{args}"
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
- c.default_desc "Makes a new task"
22
- c.action do
23
- puts "default action"
24
- end
22
+ c.default_desc "Makes a new task"
23
+ c.action do
24
+ puts "default action"
25
+ end
25
26
 
26
- c.arg "first"
27
- c.arg "second"
28
- c.arg "name", :optional
29
- c.command :"relation_1-1" do |remote|
30
- remote.action do |global,options,args|
31
- puts "relation: #{args}"
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
- c.arg "first", :multiple
36
- c.arg "second"
37
- c.arg "name", :optional
38
- c.command :"relation_n-1" do |remote|
39
- remote.action do |global,options,args|
40
- puts "relation: #{args}"
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
- c.arg "first"
45
- c.arg "second", :multiple
46
- c.arg "name", :optional
47
- c.command :"relation_1-n" do |remote|
48
- remote.action do |global,options,args|
49
- puts "relation: #{args}"
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
- desc "List things, such as tasks or contexts"
2
- long_desc %(
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
- c.default_command :tasks
13
+ command [:list] do |c|
14
+ c.default_command :tasks
14
15
 
15
- c.desc "Show long form"
16
- c.switch [:l,:long]
16
+ c.desc "Show long form"
17
+ c.switch [:l,:long]
17
18
 
18
- c.flag :required_flag, :required => true
19
- c.flag :required_flag2, :required => true
19
+ c.flag :required_flag, :required => true
20
+ c.flag :required_flag2, :required => true
20
21
 
21
- c.desc "List tasks"
22
- c.long_desc %(
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
- c.arg :task, [:optional, :multiple]
28
- c.command :tasks do |tasks|
29
- tasks.desc "blah blah crud x whatever"
30
- tasks.flag [:x], :must_match => Array
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
- tasks.flag :flag
33
+ tasks.flag :flag
33
34
 
34
- tasks.action do |global,options,args|
35
- puts options[:x].inspect
36
- puts "list tasks: #{args.join(',')}"
37
- end
35
+ tasks.action do |global,options,args|
36
+ puts options[:x].inspect
37
+ puts "list tasks: #{args.join(',')}"
38
+ end
38
39
 
39
- tasks.desc 'list open tasks'
40
- tasks.command :open do |open|
41
- open.desc "blah blah crud x whatever"
42
- open.flag [:x], :must_match => Array
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
- open.flag :flag
45
+ open.flag :flag
45
46
 
46
- open.example "todo list tasks open --flag=blah", desc: "example number 1"
47
- open.example "todo list tasks open -x foo"
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
- open.action do |global,options,args|
50
- puts "tasks open"
50
+ open.action do |global,options,args|
51
+ puts "tasks open"
52
+ end
51
53
  end
52
- end
53
54
 
54
- tasks.default_desc 'list all tasks'
55
- end
55
+ tasks.default_desc 'list all tasks'
56
+ end
56
57
 
57
- c.desc "List contexts"
58
- c.long_desc %(
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
- c.command :contexts do |contexts|
63
+ c.command :contexts do |contexts|
63
64
 
64
- contexts.desc "Foobar"
65
- contexts.switch [:f,'foobar']
65
+ contexts.desc "Foobar"
66
+ contexts.switch [:f,'foobar']
66
67
 
67
- contexts.desc "Blah"
68
- contexts.switch [:b]
68
+ contexts.desc "Blah"
69
+ contexts.switch [:b]
69
70
 
70
- contexts.flag :otherflag
71
+ contexts.flag :otherflag
71
72
 
72
- contexts.action do |global,options,args|
73
- puts "list contexts: #{args.join(',')}"
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
- # This is copied so I can have two slightly different versions of the same thing
2
- desc "LS things, such as tasks or contexts"
3
- long_desc %(
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
- c.desc "Show long form"
14
- c.switch [:l,:long]
13
+ command [:ls] do |c|
14
+ c.desc "Show long form"
15
+ c.switch [:l,:long]
15
16
 
16
- c.desc "List tasks"
17
- c.long_desc %(
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
- c.command :tasks do |tasks|
22
- tasks.desc "blah blah crud x whatever"
23
- tasks.flag [:x]
24
- tasks.action do |global,options,args|
25
- puts "ls tasks: #{args.join(',')}"
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
- c.desc "List contexts"
30
- c.long_desc %(
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
- c.command :contexts do |contexts|
35
+ c.command :contexts do |contexts|
35
36
 
36
- contexts.desc "Foobar"
37
- contexts.switch [:f,'foobar']
37
+ contexts.desc "Foobar"
38
+ contexts.switch [:f,'foobar']
38
39
 
39
- contexts.desc "Blah"
40
- contexts.switch [:b]
40
+ contexts.desc "Blah"
41
+ contexts.switch [:b]
41
42
 
42
- contexts.action do |global,options,args|
43
- puts "ls contexts: #{args.join(',')}"
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
- command [:make] do |c|
2
- c.desc "Show long form"
3
- c.flag [:l,:long]
1
+ class App
2
+ command [:make] do |c|
3
+ c.desc "Show long form"
4
+ c.flag [:l,:long]
4
5
 
5
- c.desc 'make a new task'
6
- c.command :task do |task|
7
- task.desc 'make the task a long task'
8
- task.flag [:l,:long]
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
- task.action do |g,o,a|
11
- puts 'new task'
12
- puts a.join(',')
13
- puts o[:long]
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
- task.desc 'make a bug'
17
- task.arg :argument, [:multiple, :optional]
18
- task.command :bug do |bug|
19
- bug.desc 'make this bug in the legacy system'
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
- bug.action do |g,o,a|
23
- puts 'new task bug'
45
+ context.action do |g,o,a|
46
+ puts 'new context'
24
47
  puts a.join(',')
25
- # All this .to_s is to make sure 1.8.7/REE don't convert nil to the string "nil"
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
@@ -1 +1,3 @@
1
+ class App
1
2
  command :third do |c| c.action { |g,o,a| puts "third: #{a.join(',')}" } end
3
+ 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.17.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-18 00:00:00.000000000 Z
11
+ date: 2018-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake