-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathhelp.rs
2778 lines (2388 loc) · 67.1 KB
/
help.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
use crate::utils;
use clap::{arg, error::ErrorKind, Arg, ArgGroup, Command, PossibleValue};
static REQUIRE_DELIM_HELP: &str = "test 1.3
Kevin K.
tests stuff
USAGE:
test --fake <some>:<val>
OPTIONS:
-f, --fake <some>:<val> some help
-h, --help Print help information
-V, --version Print version information
";
static HELP: &str = "clap-test v1.4.8
Kevin K. <kbknapp@gmail.com>
tests clap library
USAGE:
clap-test [OPTIONS] [ARGS] [SUBCOMMAND]
ARGS:
<positional> tests positionals
<positional2> tests positionals with exclusions
<positional3>... tests specific values [possible values: vi, emacs]
OPTIONS:
-f, --flag tests flags
-F tests flags with exclusions
-h, --help Print help information
--long-option-2 <option2> tests long options with exclusions
--maxvals3 <maxvals>... Tests 3 max vals
--minvals2 <minvals>... Tests 2 min vals
--multvals <one> <two> Tests multiple values, not mult occs
--multvalsmo <one> <two> Tests multiple values, and mult occs
-o, --option <opt>... tests options
-O, --option3 <option3> specific vals [possible values: fast, slow]
--optvaleq[=<optval>] Tests optional value, require = sign
--optvalnoeq [<optval>] Tests optional value
-V, --version Print version information
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
subcmd tests subcommands
";
static SC_NEGATES_REQS: &str = "prog 1.0
USAGE:
prog --opt <FILE> [PATH]
prog [PATH] <SUBCOMMAND>
ARGS:
<PATH> help
OPTIONS:
-h, --help Print help information
-o, --opt <FILE> tests options
-V, --version Print version information
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
test
";
static ARGS_NEGATE_SC: &str = "prog 1.0
USAGE:
prog [OPTIONS] [PATH]
prog <SUBCOMMAND>
ARGS:
<PATH> help
OPTIONS:
-f, --flag testing flags
-h, --help Print help information
-o, --opt <FILE> tests options
-V, --version Print version information
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
test
";
static AFTER_HELP: &str = "some text that comes before the help
clap-test v1.4.8
tests clap library
USAGE:
clap-test
OPTIONS:
-h, --help Print help information
-V, --version Print version information
some text that comes after the help
";
static AFTER_LONG_HELP: &str = "some longer text that comes before the help
clap-test v1.4.8
tests clap library
USAGE:
clap-test
OPTIONS:
-h, --help
Print help information
-V, --version
Print version information
some longer text that comes after the help
";
static HIDDEN_ARGS: &str = "prog 1.0
USAGE:
prog [OPTIONS]
OPTIONS:
-f, --flag testing flags
-h, --help Print help information
-o, --opt <FILE> tests options
-V, --version Print version information
";
static SC_HELP: &str = "clap-test-subcmd 0.1
Kevin K. <kbknapp@gmail.com>
tests subcommands
USAGE:
clap-test subcmd [OPTIONS] [--] [scpositional]
ARGS:
<scpositional> tests positionals
OPTIONS:
-f, --flag tests flags
-h, --help Print help information
-o, --option <scoption>... tests options
-s, --subcmdarg <subcmdarg> tests other args
-V, --version Print version information
";
static ISSUE_1046_HIDDEN_SCS: &str = "prog 1.0
USAGE:
prog [OPTIONS] [PATH]
ARGS:
<PATH> some
OPTIONS:
-f, --flag testing flags
-h, --help Print help information
-o, --opt <FILE> tests options
-V, --version Print version information
";
// Using number_of_values(1) with multiple_values(true) misaligns help message
static ISSUE_760: &str = "ctest 0.1
USAGE:
ctest [OPTIONS]
OPTIONS:
-h, --help Print help information
-o, --option <option> tests options
-O, --opt <opt> tests options
-V, --version Print version information
";
static RIPGREP_USAGE: &str = "ripgrep 0.5
USAGE:
rg [OPTIONS] <pattern> [<path> ...]
rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...]
rg [OPTIONS] --files [<path> ...]
rg [OPTIONS] --type-list
OPTIONS:
-h, --help Print help information
-V, --version Print version information
";
static MULTI_SC_HELP: &str = "ctest-subcmd-multi 0.1
Kevin K. <kbknapp@gmail.com>
tests subcommands
USAGE:
ctest subcmd multi [OPTIONS]
OPTIONS:
-f, --flag tests flags
-h, --help Print help information
-o, --option <scoption>... tests options
-V, --version Print version information
";
static ISSUE_626_CUTOFF: &str = "ctest 0.1
USAGE:
ctest [OPTIONS]
OPTIONS:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café is an
establishment which primarily serves hot
coffee, related coffee beverages (e.g., café
latte, cappuccino, espresso), tea, and other
hot beverages. Some coffeehouses also serve
cold beverages such as iced coffee and iced
tea. Many cafés also serve some type of food,
such as light snacks, muffins, or pastries.
-h, --help Print help information
-V, --version Print version information
";
static ISSUE_626_PANIC: &str = "ctest 0.1
USAGE:
ctest [OPTIONS]
OPTIONS:
-c, --cafe <FILE>
La culture du café est très développée
dans de nombreux pays à climat chaud
d\'Amérique, d\'Afrique et d\'Asie, dans
des plantations qui sont cultivées pour
les marchés d\'exportation. Le café est
souvent une contribution majeure aux
exportations des régions productrices.
-h, --help
Print help information
-V, --version
Print version information
";
static HIDE_POS_VALS: &str = "ctest 0.1
USAGE:
ctest [OPTIONS]
OPTIONS:
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.
-h, --help Print help information
-p, --pos <VAL> Some vals [possible values: fast, slow]
-V, --version Print version information
";
static FINAL_WORD_WRAPPING: &str = "ctest 0.1
USAGE:
ctest
OPTIONS:
-h, --help
Print help
information
-V, --version
Print
version
information
";
static OLD_NEWLINE_CHARS: &str = "ctest 0.1
USAGE:
ctest [OPTIONS]
OPTIONS:
-h, --help Print help information
-m Some help with some wrapping
(Defaults to something)
-V, --version Print version information
";
static WRAPPING_NEWLINE_CHARS: &str = "ctest 0.1
USAGE:
ctest [mode]
ARGS:
<mode> x, max, maximum 20 characters, contains
symbols.
l, long Copy-friendly, 14
characters, contains symbols.
m, med, medium Copy-friendly, 8
characters, contains symbols.
OPTIONS:
-h, --help Print help information
-V, --version Print version information
";
static ISSUE_688: &str = "ctest 0.1
USAGE:
ctest [OPTIONS]
OPTIONS:
--filter <filter> Sets the filter, or sampling method, to use for interpolation when resizing the particle
images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic,
Gaussian, Lanczos3]
-h, --help Print help information
-V, --version Print version information
";
static ISSUE_702: &str = "myapp 1.0
foo
bar
USAGE:
myapp [OPTIONS] [--] [ARGS]
ARGS:
<arg1> some option
<arg2>... some option
OPTIONS:
-h, --help Print help information
-l, --label <label>... a label
-o, --other <other> some other option
-s, --some <some> some option
-V, --version Print version information
";
static ISSUE_777: &str = "A cmd with a crazy very long long
long name hahaha 1.0
Some Very Long Name and crazy long
email <email@server.com>
Show how the about text is not
wrapped
USAGE:
ctest
OPTIONS:
-h, --help
Print help information
-V, --version
Print version
information
";
static ISSUE_1642: &str = "prog
USAGE:
prog [OPTIONS]
OPTIONS:
--config
The config file used by the myprog must be in JSON format
with only valid keys and may not contain other nonsense
that cannot be read by this program. Obviously I'm going on
and on, so I'll stop now.
-h, --help
Print help information
";
static HELP_CONFLICT: &str = "conflict
USAGE:
conflict [OPTIONS]
OPTIONS:
-h
--help Print help information
";
static LAST_ARG: &str = "last 0.1
USAGE:
last <TARGET> [CORPUS] [-- <ARGS>...]
ARGS:
<TARGET> some
<CORPUS> some
<ARGS>... some
OPTIONS:
-h, --help Print help information
-V, --version Print version information
";
static LAST_ARG_SC: &str = "last 0.1
USAGE:
last <TARGET> [CORPUS] [-- <ARGS>...]
last <SUBCOMMAND>
ARGS:
<TARGET> some
<CORPUS> some
<ARGS>... some
OPTIONS:
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
test some
";
static LAST_ARG_REQ: &str = "last 0.1
USAGE:
last <TARGET> [CORPUS] -- <ARGS>...
ARGS:
<TARGET> some
<CORPUS> some
<ARGS>... some
OPTIONS:
-h, --help Print help information
-V, --version Print version information
";
static LAST_ARG_REQ_SC: &str = "last 0.1
USAGE:
last <TARGET> [CORPUS] -- <ARGS>...
last <SUBCOMMAND>
ARGS:
<TARGET> some
<CORPUS> some
<ARGS>... some
OPTIONS:
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
test some
";
static HIDE_DEFAULT_VAL: &str = "default 0.1
USAGE:
default [OPTIONS]
OPTIONS:
--arg <argument> Pass an argument to the program. [default: default-argument]
-h, --help Print help information
-V, --version Print version information
";
static ESCAPED_DEFAULT_VAL: &str = "default 0.1
USAGE:
default [OPTIONS]
OPTIONS:
--arg <argument> Pass an argument to the program. [default: \"\\n\"] [possible values: normal, \" \", \"\\n\", \"\\t\",
other]
-h, --help Print help information
-V, --version Print version information
";
static LAST_ARG_USAGE: &str = "flamegraph 0.1
USAGE:
flamegraph [OPTIONS] [BINFILE] [-- <ARGS>...]
ARGS:
<BINFILE> The path of the binary to be profiled. for a binary.
<ARGS>... Any arguments you wish to pass to the being profiled.
OPTIONS:
-f, --frequency <HERTZ> The sampling frequency.
-h, --help Print help information
-t, --timeout <SECONDS> Timeout in seconds.
-v, --verbose Prints out more stuff.
-V, --version Print version information
";
static LAST_ARG_REQ_MULT: &str = "example 1.0
USAGE:
example <FIRST>... [--] <SECOND>...
ARGS:
<FIRST>... First
<SECOND>... Second
OPTIONS:
-h, --help Print help information
-V, --version Print version information
";
static DEFAULT_HELP: &str = "ctest 1.0
USAGE:
ctest
OPTIONS:
-h, --help Print help information
-V, --version Print version information
";
static LONG_ABOUT: &str = "myapp 1.0
foo
something really really long, with
multiple lines of text
that should be displayed
USAGE:
myapp [arg1]
ARGS:
<arg1>
some option
OPTIONS:
-h, --help
Print help information
-V, --version
Print version information
";
static CUSTOM_HELP_SECTION: &str = "blorp 1.4
Will M.
does stuff
USAGE:
test [OPTIONS] --fake <some>:<val>
OPTIONS:
-f, --fake <some>:<val> some help
-h, --help Print help information
-V, --version Print version information
NETWORKING:
-n, --no-proxy Do not use system proxy settings
--port
";
static ISSUE_1487: &str = "test
USAGE:
ctest <arg1|arg2>
ARGS:
<arg1>
<arg2>
OPTIONS:
-h, --help Print help information
";
static ISSUE_1364: &str = "demo
USAGE:
demo [OPTIONS] [FILES]...
ARGS:
<FILES>...
OPTIONS:
-f
-h, --help Print help information
";
static OPTION_USAGE_ORDER: &str = "order
USAGE:
order [OPTIONS]
OPTIONS:
-a
-b
-B
-h, --help Print help information
-s
--select_file
--select_folder
-x
";
static ABOUT_IN_SUBCOMMANDS_LIST: &str = "about-in-subcommands-list
USAGE:
about-in-subcommands-list [SUBCOMMAND]
OPTIONS:
-h, --help Print help information
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
sub short about sub
";
fn setup() -> Command<'static> {
Command::new("test")
.author("Kevin K.")
.about("tests stuff")
.version("1.3")
}
fn empty_args() -> impl IntoIterator<Item = String> {
std::iter::empty()
}
#[test]
fn help_short() {
let m = setup().try_get_matches_from(vec!["myprog", "-h"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::DisplayHelp);
}
#[test]
fn help_long() {
let m = setup().try_get_matches_from(vec!["myprog", "--help"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::DisplayHelp);
}
#[test]
fn help_no_subcommand() {
let m = setup().try_get_matches_from(vec!["myprog", "help"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::UnknownArgument);
}
#[test]
fn help_subcommand() {
let m = setup()
.subcommand(
Command::new("test")
.about("tests things")
.arg(arg!(-v --verbose "with verbosity")),
)
.try_get_matches_from(vec!["myprog", "help"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::DisplayHelp);
}
#[test]
fn req_last_arg_usage() {
let cmd = Command::new("example")
.version("1.0")
.arg(
Arg::new("FIRST")
.help("First")
.multiple_values(true)
.required(true),
)
.arg(
Arg::new("SECOND")
.help("Second")
.multiple_values(true)
.required(true)
.last(true),
);
assert!(utils::compare_output(
cmd,
"example --help",
LAST_ARG_REQ_MULT,
false
));
}
#[test]
fn args_with_last_usage() {
let cmd = Command::new("flamegraph")
.version("0.1")
.trailing_var_arg(true)
.arg(
Arg::new("verbose")
.help("Prints out more stuff.")
.short('v')
.long("verbose")
.multiple_occurrences(true),
)
.arg(
Arg::new("timeout")
.help("Timeout in seconds.")
.short('t')
.long("timeout")
.value_name("SECONDS"),
)
.arg(
Arg::new("frequency")
.help("The sampling frequency.")
.short('f')
.long("frequency")
.value_name("HERTZ"),
)
.arg(
Arg::new("binary path")
.help("The path of the binary to be profiled. for a binary.")
.value_name("BINFILE"),
)
.arg(
Arg::new("pass through args")
.help("Any arguments you wish to pass to the being profiled.")
.takes_value(true)
.multiple_values(true)
.last(true)
.value_name("ARGS"),
);
assert!(utils::compare_output(
cmd,
"flamegraph --help",
LAST_ARG_USAGE,
false
));
}
#[test]
fn subcommand_short_help() {
let m = utils::complex_app().try_get_matches_from(vec!["clap-test", "subcmd", "-h"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::DisplayHelp);
}
#[test]
fn subcommand_long_help() {
let m = utils::complex_app().try_get_matches_from(vec!["clap-test", "subcmd", "--help"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::DisplayHelp);
}
#[test]
fn subcommand_help_rev() {
let m = utils::complex_app().try_get_matches_from(vec!["clap-test", "help", "subcmd"]);
assert!(m.is_err());
assert_eq!(m.unwrap_err().kind(), ErrorKind::DisplayHelp);
}
#[test]
fn complex_help_output() {
assert!(utils::compare_output(
utils::complex_app(),
"clap-test --help",
HELP,
false
));
}
#[test]
fn after_and_before_help_output() {
let cmd = Command::new("clap-test")
.version("v1.4.8")
.about("tests clap library")
.before_help("some text that comes before the help")
.after_help("some text that comes after the help");
assert!(utils::compare_output(
cmd.clone(),
"clap-test -h",
AFTER_HELP,
false
));
assert!(utils::compare_output(
cmd,
"clap-test --help",
AFTER_HELP,
false
));
}
#[test]
fn after_and_before_long_help_output() {
let cmd = Command::new("clap-test")
.version("v1.4.8")
.about("tests clap library")
.before_help("some text that comes before the help")
.after_help("some text that comes after the help")
.before_long_help("some longer text that comes before the help")
.after_long_help("some longer text that comes after the help");
assert!(utils::compare_output(
cmd.clone(),
"clap-test --help",
AFTER_LONG_HELP,
false
));
assert!(utils::compare_output(
cmd,
"clap-test -h",
AFTER_HELP,
false
));
}
#[test]
fn multi_level_sc_help() {
let cmd = Command::new("ctest").subcommand(
Command::new("subcmd").subcommand(
Command::new("multi")
.about("tests subcommands")
.author("Kevin K. <kbknapp@gmail.com>")
.version("0.1")
.arg(arg!(
-f --flag "tests flags"
))
.arg(
arg!(
-o --option <scoption> "tests options"
)
.required(false)
.multiple_values(true)
.multiple_occurrences(true),
),
),
);
assert!(utils::compare_output(
cmd,
"ctest help subcmd multi",
MULTI_SC_HELP,
false
));
}
#[test]
fn no_wrap_help() {
let cmd = Command::new("ctest")
.term_width(0)
.override_help(MULTI_SC_HELP);
assert!(utils::compare_output(
cmd,
"ctest --help",
&format!("{}\n", MULTI_SC_HELP),
false
));
}
#[test]
fn no_wrap_default_help() {
let cmd = Command::new("ctest").version("1.0").term_width(0);
assert!(utils::compare_output(
cmd,
"ctest --help",
DEFAULT_HELP,
false
));
}
#[test]
#[cfg(feature = "wrap_help")]
fn wrapped_help() {
static WRAPPED_HELP: &str = "test
USAGE:
test [OPTIONS]
OPTIONS:
-a, --all
Also do versioning for private crates (will not be
published)
--exact
Specify inter dependency version numbers exactly with
`=`
-h, --help
Print help information
--no-git-commit
Do not commit version changes
--no-git-push
Do not push generated commit and tags to git remote
";
let cmd = Command::new("test")
.term_width(67)
.arg(
Arg::new("all")
.short('a')
.long("all")
.help("Also do versioning for private crates (will not be published)"),
)
.arg(
Arg::new("exact")
.long("exact")
.help("Specify inter dependency version numbers exactly with `=`"),
)
.arg(
Arg::new("no_git_commit")
.long("no-git-commit")
.help("Do not commit version changes"),
)
.arg(
Arg::new("no_git_push")
.long("no-git-push")
.help("Do not push generated commit and tags to git remote"),
);
assert!(utils::compare_output(
cmd,
"test --help",
WRAPPED_HELP,
false
));
}
#[test]
#[cfg(feature = "wrap_help")]
fn unwrapped_help() {
static UNWRAPPED_HELP: &str = "test
USAGE:
test [OPTIONS]
OPTIONS:
-a, --all Also do versioning for private crates
(will not be published)
--exact Specify inter dependency version numbers
exactly with `=`
-h, --help Print help information
--no-git-commit Do not commit version changes
--no-git-push Do not push generated commit and tags to
git remote
";
let cmd = Command::new("test")
.term_width(68)
.arg(
Arg::new("all")
.short('a')
.long("all")
.help("Also do versioning for private crates (will not be published)"),
)
.arg(
Arg::new("exact")
.long("exact")
.help("Specify inter dependency version numbers exactly with `=`"),
)
.arg(
Arg::new("no_git_commit")
.long("no-git-commit")
.help("Do not commit version changes"),
)
.arg(
Arg::new("no_git_push")
.long("no-git-push")
.help("Do not push generated commit and tags to git remote"),
);
assert!(utils::compare_output(
cmd,
"test --help",
UNWRAPPED_HELP,
false
));
}
#[test]
fn complex_subcommand_help_output() {
let a = utils::complex_app();
assert!(utils::compare_output(
a,
"clap-test subcmd --help",
SC_HELP,
false
));
}
#[test]
fn issue_626_unicode_cutoff() {
let cmd = Command::new("ctest").version("0.1").term_width(70).arg(
Arg::new("cafe")
.short('c')
.long("cafe")
.value_name("FILE")
.help(
"A coffeehouse, coffee shop, or café is an establishment \
which primarily serves hot coffee, related coffee beverages \
(e.g., café latte, cappuccino, espresso), tea, and other hot \
beverages. Some coffeehouses also serve cold beverages such as \
iced coffee and iced tea. Many cafés also serve some type of \
food, such as light snacks, muffins, or pastries.",
)
.takes_value(true),
);
assert!(utils::compare_output(
cmd,
"ctest --help",
ISSUE_626_CUTOFF,
false
));