gli 2.19.2 → 2.20.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/.circleci/config.yml +28 -0
- data/.gitignore +1 -3
- data/Gemfile +0 -6
- data/README.rdoc +2 -12
- data/Rakefile +15 -37
- data/bin/ci +29 -0
- data/bin/gli +25 -64
- data/bin/rake +29 -0
- data/bin/setup +5 -0
- data/exe/gli +68 -0
- data/gli.gemspec +19 -21
- data/gli.rdoc +2 -2
- data/lib/gli/commands/help_modules/command_help_format.rb +1 -1
- data/lib/gli/commands/help_modules/global_help_format.rb +1 -1
- data/lib/gli/commands/scaffold.rb +9 -93
- data/lib/gli/options.rb +2 -2
- data/lib/gli/version.rb +1 -1
- data/object-model.dot +29 -0
- data/object-model.png +0 -0
- data/test/apps/todo/Gemfile +1 -1
- data/test/apps/todo/bin/todo +1 -1
- data/test/integration/gli_cli_test.rb +69 -0
- data/test/integration/gli_powered_app_test.rb +52 -0
- data/test/integration/scaffold_test.rb +30 -0
- data/test/integration/test_helper.rb +52 -0
- data/test/{tc_command_finder.rb → unit/command_finder_test.rb} +6 -6
- data/test/{tc_command.rb → unit/command_test.rb} +4 -4
- data/test/unit/compound_command_test.rb +17 -0
- data/test/{tc_doc.rb → unit/doc_test.rb} +38 -51
- data/test/{tc_flag.rb → unit/flag_test.rb} +19 -25
- data/test/{tc_gli.rb → unit/gli_test.rb} +28 -47
- data/test/{tc_help.rb → unit/help_test.rb} +48 -107
- data/test/{init_simplecov.rb → unit/init_simplecov.rb} +0 -0
- data/test/{tc_options.rb → unit/options_test.rb} +4 -4
- data/test/unit/subcommand_parsing_test.rb +263 -0
- data/test/unit/subcommands_test.rb +245 -0
- data/test/{fake_std_out.rb → unit/support/fake_std_out.rb} +0 -0
- data/test/{config.yaml → unit/support/gli_test_config.yml} +0 -0
- data/test/unit/switch_test.rb +49 -0
- data/test/{tc_terminal.rb → unit/terminal_test.rb} +4 -3
- data/test/unit/test_helper.rb +13 -0
- data/test/unit/verbatim_wrapper_test.rb +24 -0
- metadata +57 -124
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -11
- data/ObjectModel.graffle +0 -1191
- data/bin/report_on_rake_results +0 -10
- data/bin/test_all_rubies.sh +0 -6
- data/features/gli_executable.feature +0 -90
- data/features/gli_init.feature +0 -236
- data/features/step_definitions/gli_executable_steps.rb +0 -18
- data/features/step_definitions/gli_init_steps.rb +0 -11
- data/features/step_definitions/todo_steps.rb +0 -100
- data/features/support/env.rb +0 -54
- data/features/support/hooks.rb +0 -5
- data/features/todo.feature +0 -579
- data/features/todo_legacy.feature +0 -130
- data/test/option_test_helper.rb +0 -13
- data/test/tc_compound_command.rb +0 -22
- data/test/tc_subcommand_parsing.rb +0 -280
- data/test/tc_subcommands.rb +0 -259
- data/test/tc_switch.rb +0 -55
- data/test/tc_verbatim_wrapper.rb +0 -36
- data/test/test_helper.rb +0 -21
data/features/support/env.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.start
|
4
|
-
rescue LoadError
|
5
|
-
# Don't care
|
6
|
-
end
|
7
|
-
require 'aruba/cucumber'
|
8
|
-
require 'fileutils'
|
9
|
-
|
10
|
-
# Adds GLI's bin dir to our path
|
11
|
-
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
12
|
-
GLI_LIB_PATH = File.expand_path(File.join(File.dirname(__FILE__),'..','..','lib'))
|
13
|
-
|
14
|
-
GLI_GEMSET = 'gli-testing'
|
15
|
-
TMP_PATH = 'tmp/aruba'
|
16
|
-
|
17
|
-
Before do
|
18
|
-
# Not sure how else to get this dynamically
|
19
|
-
@dirs = [TMP_PATH]
|
20
|
-
@aruba_timeout_seconds = 5
|
21
|
-
@original_path = ENV['PATH'].split(File::PATH_SEPARATOR)
|
22
|
-
@original_home = ENV['HOME']
|
23
|
-
new_home = "/tmp/fakehome"
|
24
|
-
FileUtils.rm_rf new_home
|
25
|
-
FileUtils.mkdir new_home
|
26
|
-
ENV['HOME'] = new_home
|
27
|
-
FileUtils.cp 'gli.rdoc','gli.rdoc.orig'
|
28
|
-
end
|
29
|
-
|
30
|
-
After do |scenario|
|
31
|
-
ENV['RUBYLIB'] = ''
|
32
|
-
todo_app_dir = File.join(TMP_PATH,'todo')
|
33
|
-
if File.exist? todo_app_dir
|
34
|
-
FileUtils.rm_rf(todo_app_dir)
|
35
|
-
end
|
36
|
-
ENV['PATH'] = @original_path.join(File::PATH_SEPARATOR)
|
37
|
-
ENV['HOME'] = @original_home
|
38
|
-
ENV['TODO_SORT_HELP'] = nil
|
39
|
-
ENV['TODO_WRAP_HELP_TEXT'] = nil
|
40
|
-
ENV['HIDE_COMMANDS_WITHOUT_DESC'] = nil
|
41
|
-
FileUtils.mv 'gli.rdoc.orig','gli.rdoc'
|
42
|
-
end
|
43
|
-
|
44
|
-
def add_to_path(dir)
|
45
|
-
ENV['PATH'] = "#{dir}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
46
|
-
end
|
47
|
-
|
48
|
-
def add_to_lib_path(path)
|
49
|
-
ENV["RUBYLIB"] = (String(ENV["RUBYLIB"]).split(File::PATH_SEPARATOR) + [path]).join(File::PATH_SEPARATOR)
|
50
|
-
end
|
51
|
-
|
52
|
-
def remove_from_lib_path(path)
|
53
|
-
ENV["RUBYLIB"] = (String(ENV["RUBYLIB"]).split(File::PATH_SEPARATOR) - [path]).join(File::PATH_SEPARATOR)
|
54
|
-
end
|
data/features/support/hooks.rb
DELETED
data/features/todo.feature
DELETED
@@ -1,579 +0,0 @@
|
|
1
|
-
Feature: The todo app has a nice user interface
|
2
|
-
As a user of the todo application
|
3
|
-
It should have a nice UI, since it's GLI-powered
|
4
|
-
|
5
|
-
Background:
|
6
|
-
Given I have GLI installed
|
7
|
-
And GLI's libs are in my path
|
8
|
-
And my terminal size is "80x24"
|
9
|
-
And todo's bin directory is in my path
|
10
|
-
|
11
|
-
Scenario: Error message for unknown command
|
12
|
-
When I run `todo help unknown`
|
13
|
-
Then the output should contain:
|
14
|
-
"""
|
15
|
-
error: Unknown command 'unknown'. Use 'todo help' for a list of commands.
|
16
|
-
"""
|
17
|
-
|
18
|
-
Scenario: Getting Help for todo in general
|
19
|
-
When I successfully run `todo help`
|
20
|
-
Then the exit status should be 0
|
21
|
-
Then the output should contain:
|
22
|
-
"""
|
23
|
-
NAME
|
24
|
-
todo - Manages tasks
|
25
|
-
|
26
|
-
A test program that has a sophisticated UI that can be used to exercise a
|
27
|
-
lot of GLI's power
|
28
|
-
|
29
|
-
SYNOPSIS
|
30
|
-
todo [global options] command [command options] [arguments...]
|
31
|
-
|
32
|
-
VERSION
|
33
|
-
0.0.1
|
34
|
-
|
35
|
-
GLOBAL OPTIONS
|
36
|
-
--flag=arg - (default: none)
|
37
|
-
--help - Show this message
|
38
|
-
--[no-]otherswitch -
|
39
|
-
--[no-]switch -
|
40
|
-
--version - Display the program version
|
41
|
-
|
42
|
-
COMMANDS
|
43
|
-
chained -
|
44
|
-
chained2, ch2 -
|
45
|
-
create, new - Create a new task or context
|
46
|
-
first -
|
47
|
-
help - Shows a list of commands or help for one command
|
48
|
-
initconfig - Initialize the config file using current global options
|
49
|
-
list - List things, such as tasks or contexts
|
50
|
-
ls - LS things, such as tasks or contexts
|
51
|
-
make -
|
52
|
-
second -
|
53
|
-
third -
|
54
|
-
"""
|
55
|
-
|
56
|
-
Scenario: Version display
|
57
|
-
When I successfully run `todo --version`
|
58
|
-
Then the output should contain:
|
59
|
-
"""
|
60
|
-
todo version 0.0.1
|
61
|
-
"""
|
62
|
-
|
63
|
-
Scenario: --version flag displays version instead of executing command
|
64
|
-
When I successfully run `todo --version ls`
|
65
|
-
Then the output should contain:
|
66
|
-
"""
|
67
|
-
todo version 0.0.1
|
68
|
-
"""
|
69
|
-
|
70
|
-
Scenario: Help completion mode
|
71
|
-
When I successfully run `todo help -c`
|
72
|
-
Then the output should contain:
|
73
|
-
"""
|
74
|
-
_doc
|
75
|
-
ch2
|
76
|
-
chained
|
77
|
-
chained2
|
78
|
-
create
|
79
|
-
first
|
80
|
-
help
|
81
|
-
initconfig
|
82
|
-
list
|
83
|
-
ls
|
84
|
-
make
|
85
|
-
new
|
86
|
-
second
|
87
|
-
third
|
88
|
-
"""
|
89
|
-
|
90
|
-
Scenario: Help completion mode for partial match
|
91
|
-
When I successfully run `todo help -c ch`
|
92
|
-
Then the output should contain:
|
93
|
-
"""
|
94
|
-
ch2
|
95
|
-
chained
|
96
|
-
chained2
|
97
|
-
"""
|
98
|
-
|
99
|
-
Scenario: Help completion mode for subcommands
|
100
|
-
When I successfully run `todo help -c list`
|
101
|
-
Then the output should contain:
|
102
|
-
"""
|
103
|
-
contexts
|
104
|
-
tasks
|
105
|
-
"""
|
106
|
-
|
107
|
-
Scenario: Help completion mode partial match for subcommands
|
108
|
-
When I successfully run `todo help -c list con`
|
109
|
-
Then the output should contain:
|
110
|
-
"""
|
111
|
-
contexts
|
112
|
-
"""
|
113
|
-
|
114
|
-
Scenario: Getting Help with self-ordered commands
|
115
|
-
Given the todo app is coded to avoid sorted help commands
|
116
|
-
When I successfully run `todo help`
|
117
|
-
Then the output should contain:
|
118
|
-
"""
|
119
|
-
NAME
|
120
|
-
todo - Manages tasks
|
121
|
-
|
122
|
-
A test program that has a sophisticated UI that can be used to exercise a
|
123
|
-
lot of GLI's power
|
124
|
-
|
125
|
-
SYNOPSIS
|
126
|
-
todo [global options] command [command options] [arguments...]
|
127
|
-
|
128
|
-
VERSION
|
129
|
-
0.0.1
|
130
|
-
|
131
|
-
GLOBAL OPTIONS
|
132
|
-
--flag=arg - (default: none)
|
133
|
-
--[no-]switch -
|
134
|
-
--[no-]otherswitch -
|
135
|
-
--version - Display the program version
|
136
|
-
--help - Show this message
|
137
|
-
|
138
|
-
COMMANDS
|
139
|
-
help - Shows a list of commands or help for one command
|
140
|
-
initconfig - Initialize the config file using current global options
|
141
|
-
create, new - Create a new task or context
|
142
|
-
list - List things, such as tasks or contexts
|
143
|
-
ls - LS things, such as tasks or contexts
|
144
|
-
make -
|
145
|
-
third -
|
146
|
-
first -
|
147
|
-
second -
|
148
|
-
chained -
|
149
|
-
chained2, ch2 -
|
150
|
-
"""
|
151
|
-
|
152
|
-
Scenario: Getting Help with commands without description hidden
|
153
|
-
Given the todo app is coded to hide commands without description
|
154
|
-
When I successfully run `todo help`
|
155
|
-
Then the output should contain:
|
156
|
-
"""
|
157
|
-
NAME
|
158
|
-
todo - Manages tasks
|
159
|
-
|
160
|
-
A test program that has a sophisticated UI that can be used to exercise a
|
161
|
-
lot of GLI's power
|
162
|
-
|
163
|
-
SYNOPSIS
|
164
|
-
todo [global options] command [command options] [arguments...]
|
165
|
-
|
166
|
-
VERSION
|
167
|
-
0.0.1
|
168
|
-
|
169
|
-
GLOBAL OPTIONS
|
170
|
-
--flag=arg - (default: none)
|
171
|
-
--help - Show this message
|
172
|
-
--[no-]otherswitch -
|
173
|
-
--[no-]switch -
|
174
|
-
--version - Display the program version
|
175
|
-
|
176
|
-
COMMANDS
|
177
|
-
create, new - Create a new task or context
|
178
|
-
help - Shows a list of commands or help for one command
|
179
|
-
initconfig - Initialize the config file using current global options
|
180
|
-
list - List things, such as tasks or contexts
|
181
|
-
ls - LS things, such as tasks or contexts
|
182
|
-
"""
|
183
|
-
|
184
|
-
Scenario Outline: Getting Help for a top level command of todo
|
185
|
-
# No idea why I have to do this again.
|
186
|
-
Given todo's bin directory is in my path
|
187
|
-
When I successfully run `todo <help_invocation>`
|
188
|
-
Then the output should contain:
|
189
|
-
"""
|
190
|
-
NAME
|
191
|
-
list - List things, such as tasks or contexts
|
192
|
-
|
193
|
-
SYNOPSIS
|
194
|
-
todo [global options] list [command options] [tasks] [--flag arg] [-x arg] [task]...
|
195
|
-
todo [global options] list [command options] contexts [--otherflag arg] [-b] [-f|--foobar]
|
196
|
-
|
197
|
-
DESCRIPTION
|
198
|
-
List a whole lot of things that you might be keeping track of in your
|
199
|
-
overall todo list.
|
200
|
-
|
201
|
-
This is your go-to place or finding all of the things that you might have
|
202
|
-
stored in your todo databases.
|
203
|
-
|
204
|
-
COMMAND OPTIONS
|
205
|
-
-l, --[no-]long - Show long form
|
206
|
-
--required_flag=arg - (required, default: none)
|
207
|
-
--required_flag2=arg - (required, default: none)
|
208
|
-
|
209
|
-
COMMANDS
|
210
|
-
contexts - List contexts
|
211
|
-
tasks - List tasks (default)
|
212
|
-
"""
|
213
|
-
|
214
|
-
Examples:
|
215
|
-
| help_invocation |
|
216
|
-
| help list |
|
217
|
-
| list -h |
|
218
|
-
| list --help |
|
219
|
-
| --help list |
|
220
|
-
|
221
|
-
Scenario: Getting Help for a leaf command of todo
|
222
|
-
Given todo's bin directory is in my path
|
223
|
-
When I successfully run `todo help list tasks open`
|
224
|
-
Then the output should contain:
|
225
|
-
"""
|
226
|
-
NAME
|
227
|
-
open - list open tasks
|
228
|
-
|
229
|
-
SYNOPSIS
|
230
|
-
todo [global options] list tasks open [command options]
|
231
|
-
|
232
|
-
COMMAND OPTIONS
|
233
|
-
--flag=arg - (default: none)
|
234
|
-
-x arg - blah blah crud x whatever (default: none)
|
235
|
-
|
236
|
-
EXAMPLES
|
237
|
-
|
238
|
-
# example number 1
|
239
|
-
todo list tasks open --flag=blah
|
240
|
-
|
241
|
-
todo list tasks open -x foo
|
242
|
-
"""
|
243
|
-
|
244
|
-
Scenario: Getting Help for a top level command of todo with no command options
|
245
|
-
When I successfully run `todo help chained`
|
246
|
-
Then the output should contain:
|
247
|
-
"""
|
248
|
-
NAME
|
249
|
-
chained -
|
250
|
-
|
251
|
-
SYNOPSIS
|
252
|
-
todo [global options] chained
|
253
|
-
"""
|
254
|
-
|
255
|
-
Scenario: Getting Help with no wrapping
|
256
|
-
Given the todo app is coded to avoid wrapping text
|
257
|
-
When I successfully run `todo help list`
|
258
|
-
Then the output should contain:
|
259
|
-
"""
|
260
|
-
NAME
|
261
|
-
list - List things, such as tasks or contexts
|
262
|
-
|
263
|
-
SYNOPSIS
|
264
|
-
todo [global options] list [command options] [tasks] [--flag arg] [-x arg] [task]...
|
265
|
-
todo [global options] list [command options] contexts [--otherflag arg] [-b] [-f|--foobar]
|
266
|
-
|
267
|
-
DESCRIPTION
|
268
|
-
List a whole lot of things that you might be keeping track of in your overall todo list. This is your go-to place or finding all of the things that you might have stored in your todo databases.
|
269
|
-
|
270
|
-
COMMAND OPTIONS
|
271
|
-
-l, --[no-]long - Show long form
|
272
|
-
--required_flag=arg - (required, default: none)
|
273
|
-
--required_flag2=arg - (required, default: none)
|
274
|
-
|
275
|
-
COMMANDS
|
276
|
-
contexts - List contexts
|
277
|
-
tasks - List tasks (default)
|
278
|
-
"""
|
279
|
-
|
280
|
-
Scenario: Getting Help with verbatim formatting
|
281
|
-
Given the todo app is coded to use verbatim formatting
|
282
|
-
When I successfully run `todo help list`
|
283
|
-
Then the output should contain:
|
284
|
-
"""
|
285
|
-
NAME
|
286
|
-
list - List things, such as tasks or contexts
|
287
|
-
|
288
|
-
SYNOPSIS
|
289
|
-
todo [global options] list [command options] [tasks] [--flag arg] [-x arg] [task]...
|
290
|
-
todo [global options] list [command options] contexts [--otherflag arg] [-b] [-f|--foobar]
|
291
|
-
|
292
|
-
DESCRIPTION
|
293
|
-
|
294
|
-
List a whole lot of things that you might be keeping track of
|
295
|
-
in your overall todo list.
|
296
|
-
|
297
|
-
This is your go-to place or finding all of the things that you
|
298
|
-
might have
|
299
|
-
stored in
|
300
|
-
your todo databases.
|
301
|
-
|
302
|
-
|
303
|
-
COMMAND OPTIONS
|
304
|
-
-l, --[no-]long - Show long form
|
305
|
-
--required_flag=arg - (required, default: none)
|
306
|
-
--required_flag2=arg - (required, default: none)
|
307
|
-
|
308
|
-
COMMANDS
|
309
|
-
contexts - List contexts
|
310
|
-
tasks - List tasks (default)
|
311
|
-
"""
|
312
|
-
|
313
|
-
Scenario: Getting Help without wrapping
|
314
|
-
Given the todo app is coded to wrap text only for tty
|
315
|
-
When I successfully run `todo help list`
|
316
|
-
Then the output should contain:
|
317
|
-
"""
|
318
|
-
NAME
|
319
|
-
list - List things, such as tasks or contexts
|
320
|
-
|
321
|
-
SYNOPSIS
|
322
|
-
todo [global options] list [command options] [tasks] [--flag arg] [-x arg] [task]...
|
323
|
-
todo [global options] list [command options] contexts [--otherflag arg] [-b] [-f|--foobar]
|
324
|
-
|
325
|
-
DESCRIPTION
|
326
|
-
List a whole lot of things that you might be keeping track of in your overall todo list. This is your go-to place or finding all of the things that you might have stored in your todo databases.
|
327
|
-
|
328
|
-
COMMAND OPTIONS
|
329
|
-
-l, --[no-]long - Show long form
|
330
|
-
--required_flag=arg - (required, default: none)
|
331
|
-
--required_flag2=arg - (required, default: none)
|
332
|
-
|
333
|
-
COMMANDS
|
334
|
-
contexts - List contexts
|
335
|
-
tasks - List tasks (default)
|
336
|
-
"""
|
337
|
-
|
338
|
-
Scenario: Getting Help for a sub command of todo list
|
339
|
-
When I successfully run `todo help list tasks`
|
340
|
-
Then the output should contain:
|
341
|
-
"""
|
342
|
-
NAME
|
343
|
-
tasks - List tasks
|
344
|
-
|
345
|
-
SYNOPSIS
|
346
|
-
todo [global options] list tasks [command options] [task]...
|
347
|
-
todo [global options] list tasks [command options] open [--flag arg] [-x arg]
|
348
|
-
|
349
|
-
DESCRIPTION
|
350
|
-
Lists all of your tasks that you have, in varying orders, and all that
|
351
|
-
stuff. Yes, this is long, but I need a long description.
|
352
|
-
|
353
|
-
COMMAND OPTIONS
|
354
|
-
--flag=arg - (default: none)
|
355
|
-
-x arg - blah blah crud x whatever (default: none)
|
356
|
-
|
357
|
-
COMMANDS
|
358
|
-
<default> - list all tasks
|
359
|
-
open - list open tasks
|
360
|
-
"""
|
361
|
-
|
362
|
-
Scenario: Getting Help for a sub command with no command options
|
363
|
-
When I successfully run `todo help new`
|
364
|
-
Then the output should contain:
|
365
|
-
"""
|
366
|
-
NAME
|
367
|
-
create - Create a new task or context
|
368
|
-
|
369
|
-
SYNOPSIS
|
370
|
-
todo [global options] create
|
371
|
-
todo [global options] create contexts [context_name]
|
372
|
-
todo [global options] create relation_1-1 first second [name]
|
373
|
-
todo [global options] create relation_1-n first second... [name]
|
374
|
-
todo [global options] create relation_n-1 first... second [name]
|
375
|
-
todo [global options] create tasks task_name...
|
376
|
-
|
377
|
-
COMMANDS
|
378
|
-
<default> - Makes a new task
|
379
|
-
contexts - Make a new context
|
380
|
-
relation_1-1 -
|
381
|
-
relation_1-n -
|
382
|
-
relation_n-1 -
|
383
|
-
tasks - Make a new task
|
384
|
-
"""
|
385
|
-
And the output should not contain "COMMAND OPTIONS"
|
386
|
-
|
387
|
-
Scenario: Running list w/out subcommand performs list tasks by default
|
388
|
-
When I successfully run `todo list --required_flag=blah --required_flag2=bleh boo yay`
|
389
|
-
Then the output should contain "list tasks: boo,yay"
|
390
|
-
|
391
|
-
Scenario: Running list w/out subcommand or any arguments performs list tasks by default
|
392
|
-
When I successfully run `todo list --required_flag=blah --required_flag2=bleh`
|
393
|
-
Then the output should contain "list tasks:"
|
394
|
-
|
395
|
-
Scenario: Running chained commands works
|
396
|
-
When I successfully run `todo chained foo bar`
|
397
|
-
Then the output should contain:
|
398
|
-
"""
|
399
|
-
first: foo,bar
|
400
|
-
second: foo,bar
|
401
|
-
"""
|
402
|
-
|
403
|
-
Scenario: Running chained commands works and is ordered
|
404
|
-
When I successfully run `todo chained2 foo bar`
|
405
|
-
Then the output should contain:
|
406
|
-
"""
|
407
|
-
second: foo,bar
|
408
|
-
first: foo,bar
|
409
|
-
"""
|
410
|
-
|
411
|
-
Scenario: Running chained commands works and is ordered
|
412
|
-
When I successfully run `todo ch2 foo bar`
|
413
|
-
Then the output should contain:
|
414
|
-
"""
|
415
|
-
second: foo,bar
|
416
|
-
first: foo,bar
|
417
|
-
"""
|
418
|
-
|
419
|
-
Scenario: Running ls w/out subcommand shows help and an error
|
420
|
-
When I run `todo ls`
|
421
|
-
Then the exit status should not be 0
|
422
|
-
And the stderr should contain "error: Command 'ls' requires a subcommand"
|
423
|
-
And the stdout should contain:
|
424
|
-
"""
|
425
|
-
NAME
|
426
|
-
ls - LS things, such as tasks or contexts
|
427
|
-
|
428
|
-
SYNOPSIS
|
429
|
-
todo [global options] ls [command options] contexts [-b] [-f|--foobar]
|
430
|
-
todo [global options] ls [command options] tasks [-x arg]
|
431
|
-
|
432
|
-
DESCRIPTION
|
433
|
-
List a whole lot of things that you might be keeping track of in your
|
434
|
-
overall todo list.
|
435
|
-
|
436
|
-
This is your go-to place or finding all of the things that you might have
|
437
|
-
stored in your todo databases.
|
438
|
-
|
439
|
-
COMMAND OPTIONS
|
440
|
-
-l, --[no-]long - Show long form
|
441
|
-
|
442
|
-
COMMANDS
|
443
|
-
contexts - List contexts
|
444
|
-
tasks - List tasks
|
445
|
-
"""
|
446
|
-
|
447
|
-
Scenario: Access to the complex command-line options for nested subcommands
|
448
|
-
Given I run `todo make -l MAKE task -l TASK bug -l BUG other args`
|
449
|
-
Then the exit status should be 0
|
450
|
-
And the stdout should contain:
|
451
|
-
"""
|
452
|
-
new task bug
|
453
|
-
other,args
|
454
|
-
BUG
|
455
|
-
|
456
|
-
BUG
|
457
|
-
TASK
|
458
|
-
TASK
|
459
|
-
|
460
|
-
MAKE
|
461
|
-
MAKE
|
462
|
-
|
463
|
-
"""
|
464
|
-
|
465
|
-
Scenario: Init Config makes a reasonable config file
|
466
|
-
Given a clean home directory
|
467
|
-
When I successfully run `todo --flag foo --switch --no-otherswitch initconfig`
|
468
|
-
Then the config file should contain a section for each command and subcommand
|
469
|
-
|
470
|
-
Scenario: Init Config makes a reasonable config file if one is there and we force it
|
471
|
-
Given a clean home directory
|
472
|
-
And I successfully run `todo --flag foo --switch --no-otherswitch initconfig`
|
473
|
-
When I run `todo --flag foo --switch --no-otherswitch initconfig`
|
474
|
-
Then the exit status should not be 0
|
475
|
-
When I run `todo --flag foo --switch --no-otherswitch initconfig --force`
|
476
|
-
Then the exit status should be 0
|
477
|
-
|
478
|
-
Scenario: Configuration percolates to the app
|
479
|
-
Given a clean home directory
|
480
|
-
And a config file that specifies defaults for some commands with subcommands
|
481
|
-
When I successfully run `todo help list tasks`
|
482
|
-
Then I should see the defaults for 'list tasks' from the config file in the help
|
483
|
-
|
484
|
-
Scenario: Do it again because aruba buffers all output
|
485
|
-
Given a clean home directory
|
486
|
-
And a config file that specifies defaults for some commands with subcommands
|
487
|
-
When I successfully run `todo help list contexts`
|
488
|
-
Then I should see the defaults for 'list contexts' from the config file in the help
|
489
|
-
|
490
|
-
Scenario: A complex SYNOPSIS section gets summarized in terminal mode
|
491
|
-
Given my terminal is 50 characters wide
|
492
|
-
And my app is configured for "terminal" synopses
|
493
|
-
When I run `todo ls`
|
494
|
-
Then the exit status should not be 0
|
495
|
-
And the stderr should contain "error: Command 'ls' requires a subcommand"
|
496
|
-
And the stdout should contain:
|
497
|
-
"""
|
498
|
-
NAME
|
499
|
-
ls - LS things, such as tasks or contexts
|
500
|
-
|
501
|
-
SYNOPSIS
|
502
|
-
todo [global options] ls [command options] contexts [subcommand options]
|
503
|
-
todo [global options] ls [command options] tasks [subcommand options]
|
504
|
-
"""
|
505
|
-
|
506
|
-
Scenario: We can always use a compact SYNOPSIS
|
507
|
-
Given my terminal is 500 characters wide
|
508
|
-
And my app is configured for "compact" synopses
|
509
|
-
When I run `todo ls`
|
510
|
-
Then the exit status should not be 0
|
511
|
-
And the stderr should contain "error: Command 'ls' requires a subcommand"
|
512
|
-
And the stdout should contain:
|
513
|
-
"""
|
514
|
-
NAME
|
515
|
-
ls - LS things, such as tasks or contexts
|
516
|
-
|
517
|
-
SYNOPSIS
|
518
|
-
todo [global options] ls [command options] contexts [subcommand options]
|
519
|
-
todo [global options] ls [command options] tasks [subcommand options]
|
520
|
-
"""
|
521
|
-
|
522
|
-
Scenario: We get a clear error message when a required argument is missing
|
523
|
-
Given a clean home directory
|
524
|
-
When I run `todo list`
|
525
|
-
Then the exit status should not be 0
|
526
|
-
And the stderr should contain "error: required_flag is required, required_flag2 is required"
|
527
|
-
And the output should contain:
|
528
|
-
"""
|
529
|
-
NAME
|
530
|
-
list - List things, such as tasks or contexts
|
531
|
-
|
532
|
-
SYNOPSIS
|
533
|
-
todo [global options] list [command options] [tasks] [subcommand options] [task]...
|
534
|
-
todo [global options] list [command options] contexts [subcommand options]
|
535
|
-
|
536
|
-
DESCRIPTION
|
537
|
-
List a whole lot of things that you might be keeping track of in your
|
538
|
-
overall todo list.
|
539
|
-
|
540
|
-
This is your go-to place or finding all of the things that you might have
|
541
|
-
stored in your todo databases.
|
542
|
-
|
543
|
-
COMMAND OPTIONS
|
544
|
-
-l, --[no-]long - Show long form
|
545
|
-
--required_flag=arg - (required, default: none)
|
546
|
-
--required_flag2=arg - (required, default: none)
|
547
|
-
|
548
|
-
COMMANDS
|
549
|
-
contexts - List contexts
|
550
|
-
tasks - List tasks (default)
|
551
|
-
"""
|
552
|
-
|
553
|
-
Scenario: Getting help on a root command with an arg_name outputs the argument description
|
554
|
-
When I run `todo help first`
|
555
|
-
And the stdout should contain:
|
556
|
-
"""
|
557
|
-
NAME
|
558
|
-
first -
|
559
|
-
|
560
|
-
SYNOPSIS
|
561
|
-
todo [global options] first [argument]
|
562
|
-
"""
|
563
|
-
|
564
|
-
Scenario: Getting help on a root command with an arg outputs the argument description
|
565
|
-
When I run `todo help second`
|
566
|
-
And the stdout should contain:
|
567
|
-
"""
|
568
|
-
NAME
|
569
|
-
second -
|
570
|
-
|
571
|
-
SYNOPSIS
|
572
|
-
todo [global options] second [argument]
|
573
|
-
"""
|
574
|
-
|
575
|
-
Scenario: Generate app documentation
|
576
|
-
When I run `todo _doc`
|
577
|
-
Then the exit status should be 0
|
578
|
-
And a file named "todo.rdoc" should exist
|
579
|
-
And the file "todo.rdoc" should contain "Lists all of your contexts, which are places you might be"
|