gitignore-template-generator 0.14.5

A binary crate to generate templates for .gitignore files
Documentation
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
# Documentation

Welcome to the documentation of `gitignore_template_generator` crate.

This crate is mainly binary but has been designed with a well-structured
library crate anyone can reuse to craft his own custom flavor of gitignore
template generation.

Here, you'll find detailed infos on [how to install the crate](#installation),
[how to use the CLI tool](#usage), [the available feature flags](#features),
[general rules around the CLI parser](#general-rules),
[how each supported CLI options work](#cli-options), with examples, as well as
[technical documentation on the library components](#modules) (i.e. modules,
structs, enums and traits) used by the binary.

- [Installation]#installation
- [Usage]#usage
- [Features]#features
- [General rules]#general-rules
- [CLI options]#cli-options
- [Technical documentation]#modules

## Installation

Run the below command to globally install the **gitignore-template-generator**
binary:

```bash
cargo install gitignore-template-generator
```

To install it as a library, run the following `Cargo` command in your project
directory:

```bash
cargo add gitignore-template-generator
```

Or add the following line to your `Cargo.toml`:

```yaml
gitignore-template-generator = "0.14.5"
```

## Usage

Available options:

```text
Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

Generate templates for .gitignore files

Arguments:
  [TEMPLATE_NAMES]...  A non-empty list of gitignore template names

Options:
  -c, --check                          Enable robust template names check
  -g, --generator-uri <GENERATOR_URI>  The template generator uri [default: /developers/gitignore/api]
  -l, --list                           List available templates
  -i, --lister-uri <LISTER_URI>        The template lister uri [default: /developers/gitignore/api/list]
  -s, --server-url <SERVER_URL>        The template manager url [default: https://www.toptal.com]
  -t, --timeout <TIMEOUT>              The template generation and listing service calls timeout [default: 5s/5000ms]
  -u, --timeout-unit <TIMEOUT_UNIT>    The timeout unit [default: second] [possible values: millisecond, second]
  -h, --help                           Print help
  -V, --version                        Print version
  -a, --author                         Print author

Version: 0.14.5
Author: Patacode <pata.codegineer@gmail.com>
```

By default, the CLI tool is a simple API binder to `toptal` gitignore template
generation service. It takes gitignore template names as positional arguments
and generates a gitignore template for you:

```text
$ gitignore-template-generator rust python java
# ...
# some template for a project in rust, python and java
# ...
```

Each generated template is trimmed, merged into one, and printed to `stdout`,
so you can easily redirect or pipe it if needed. Any error will be
printed to `stderr`.

Behind the scene, it calls the template generator service as pointed to by
the [-g --generator-uri](#-g-generator-uri) option.

Positional arguments cannot contains comma (`,`) nor `White_Space` characters
(as defined in the [Unicode Character Database](https://www.unicode.org/reports/tr44)
[`PropList.txt`](https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt)):

```text
$ gitignore -template-generator "rust," "python"
error: invalid value 'rust,' for '[TEMPLATE_NAMES]...': Commas are not allowed in template names

For more information, try '--help'.
$ gitignore-template-generator "rus t" "python"
error: invalid value 'rus t' for '[TEMPLATE_NAMES]...': Whitespace characters are not allowed in template names

For more information, try '--help'.
```

Also, unless you specified the [-l --list](#-l-list), [-h --help](#-h-help),
[-V --version](#-V-version) or [-a --author](#-a-author) options—which
exempt the tool from its normal flow—you must give at least one template
name:

```text
$ gitignore-template-generator
error: the following required arguments were not provided:
  <TEMPLATE_NAMES>...

Usage: gitignore-template-generator <TEMPLATE_NAMES>...

For more information, try '--help'.
```

## Features

This crate comes with various features you can freely enable/disable as per
your needs.

By default, you have the `clap` CLI parser along with `ureq` HTTP client crates,
with simple API binding to `toptal` gitignore template generation service
(see [above usage section](#usage) for more infos).

The default crate's flavor might be too feature-rich for your use case, or
you might feel it lacks features. To customize its behavior, here are the
available features you can opt in or out:

- [Cli]#cli
- [Remote templating]#remote-templating
- [Local templating]#local-templating

Be noted that:

- The `cli` and `remote_templating` features are enabled by default
- The `local_templating` feature can be enabled on-demand
- Either `remote_templating` or `local_templating` must be enabled at any time

To install the crate with all the features (default `cli` and `remote_templating` features + optional `local_templating`):

```bash
cargo install gitignore-template-generator --features local_templating 
```

With only specific features:

```bash
# cli and local_templating only
cargo install gitignore-template-generator --no-default-features --features "cli local_templating" 
```

Enabled features will be listed on last line of [-h --help](#-h-help) output.
For example, if both `cli` and `local_templating` are enabled, you would see
the below at the end:

```text
Features: cli, local_templating
```

### Cli

*Required for now but coming soon as a feature flag*

- **Feature flag**: `cli`
- **Default**: `yes`
- **Dependency**: `clap`

This feature allows the use of `clap` as a CLI parser.

It makes the crate much heavier but allows for a full-fledged experience
with it.

It's the default, see [above usage section](#usage) for more infos.

### Remote templating

*Required for now but coming soon as a feature flag*

- **Feature flag**: `remote_templating`
- **Default**: `yes`
- **Dependency**: `ureq`

This feature allows to generate gitignore templates through HTTP using a remote
API.

It's the default, see [above usage section](#usage) for more infos.

### Local templating

- **Feature flag**: `local_templating`
- **Default**: `no`
- **Dependency**: `/`

This feature allows to generate gitignore templates using *template files*
stored on local file system.

These *templates files* are regular text files prefixed with the `.txt` file
extension. If not prefixed with expected file extension, they will not be
considered.

When generating a gitignore template (e.g.
`gitignore-template-generator rust python`), the binary crate will fetch for
templates in the directory pointed to by the environment variable
`GITIGNORE_TEMPLATE_GENERATOR_HOME` (effectively reading the content of
named files). If not set, it will fall back to
`$HOME/.gitignore_template_generator/templates`.

If pointed directory does not exist, the binary crate will simply consider it
as an empty database, not supporting any template names.

Each template generated from your local file system will be trimmed, titled
with `### <name> ###`, where `<name>` corresponds to
its name in capitalized form, sorted by alphabetic order, merged into one,
and printed to `stdout`.

If unsupported template names are provided, or any other error occurred (e.g.
filesystem error, insufficient privilege...), error will be propagated and
printed to `stderr`.

#### With remote templating

When this feature is combined with [remote templating](#remote-templating),
locally-generated templates will be merged into remotely-generated ones,
grouped into two sections named `## LOCAL\n\n` and `## REMOTE\n\n` respectively,
with local templates always being defined first, and prefixed with a star (`*`).
Here is an example where `foo` would be a local template and `bar` a remote
one:

```text
$ gitignore-template-generator foo bar
## LOCAL

### *Foo ###
Foo template

## REMOTE

### Bar ###
Bar template
```

In [-l --list](#-l-list) output, their name will also be prefixed with a
star (`*`). Taking the same example scenario as above, here would be the
expected output:

```text
$ gitignore-template-generator --list
*foo
bar
```

Additionally, robust template names check enabled through the
[-c --check](#-c-check) option, will now include both local and remote
templates.

Here is the expected workflow when generating a gitignore template with both
remote and local templating enabled:

1. Fetch the list of local and remote templates
2. Generate from local any *valid* templates (i.e. present in fetched list,
   thus stored on your local file system)
3. Generate from remote any remaining *valid* templates (i.e. present in
   fetched list, thus supported by the templating service)
4. Propagate any errors that occurred, either remotely or locally. This includes
   error messages to `stderr` and script's return value,
   which, for the former, will be the concatenation with plus sign (`+`) of all
   the errors that occurred, and for the latter, will be the sum of remote and
   local exit status

A slight overhead is to be expected as local and remote template lists need
to be fetched upfront in order to determine from which data source (i.e. local
file system or remote server) each template has to be generated.

But this allows for a more granular error message in case no matched
templates were found, neither locally, nor remotely:

```text
$ gitignore-template-generator unknown
One or more provided template names are not supported.
To enable robust template names check, retry with '--check'.
For the list of available template names, try '--list'.
```

If you have a local template with the same name as a remote one, both will be
merged into final output. Here is an example where it exists a template named
`bar` in both local and remote source:

```text
$ gitignore-template-generator bar
## LOCAL

### *Bar ###
Local bar template

## REMOTE

### Bar ###
Remote bar template
```

## General rules

The CLI engine parsing your arguments supports a variety of alternative syntax
for you to specify *positional* and *named* arguments. Let's
have a look at each one of them.

Be noted that, all your arguments, being either *positional* or *named*, are
separated from each others by a space character (` `).

- [Positional arguments]#positional-arguments
- [Named arguments]#named-arguments
  - [Boolean options]#boolean-options

### Positional Arguments

These arguments are strings provided as-is, without the `-` or `--` prefix:

```text
& gitignore-template-generator rust python java
```

In above example, `rust`, `python` and `java` constitute the *positional*
arguments provided to **gitignore-template-generator**.

They can be surrounded by single (`'`) or double (`"`) quotes, allowing you to
escape any *invalid* characters:

```text
& gitignore-template-generator "rust"
& gitignore-template-generator 'python'
& gitignore-template-generator "java" 'go'
& gitignore-template-generator "jav a" 'g -o'
```

Last line in above example is just to showcase the possibility of providing
`White_Space` characters—which can't be provided without quoting your
argument—but is not valid in the context of **gitignore-template-generator**.

### Named Arguments

These arguments are formed by the pair `option` + `value`, where `option`
represents a string prefixed by the dash (`-`) or double-dash (`--`) character,
and where `value` represents a string provided as-is, same as a
*positional* argument, supporting the same rules and syntax:

```text
& gitignore-template-generator rust --timeout 10
& gitignore-template-generator --server-url "https://myapis.foobar.com" python java
& gitignore-template-generator -c pyth java rut
```

Each related option supports a short and long naming. For example, in the
context of **gitignore-template-generator**, the
[generator-uri](#-g-generator-uri) option, can be specified as `-g` or
`--generator-uri`.

To separate the `option` from its `value`, you can either use the space character
(` `), the equal sign (`=`), or no separator if the `option` is
specified using its short naming:

```text
& gitignore-template-generator rust --timeout 10
& gitignore-template-generator --server-url="https://myapis.foobar.com" python java
& gitignore-template-generator -t33 python java rust
```

Same as for *positional* arguments, *named* arguments can be surrounded by
single (`'`) or double (`"`) quotes, allowing you to escape any *invalid*
characters:

```text
& gitignore-template-generator '--server-url=https://myapis.foobar.com' python java
& gitignore-template-generator "-t33" python java rust
& gitignore-template-generator "-t'33'" python java rust
```

Last line in above example is just to showcase the possibility of providing
*invalid* characters (`'` in this case). It will effectively provide `'33'` as
a value to the `-t` option, but is not valid in the context of
**gitignore-template-generator**.

Although rarely used, you can also surround the `option` part with single (`'`)
or double (`"`) quotes:

```text
& gitignore-template-generator '--server-url'="https://myapis.foobar.com" python java
```

Moreover, depending on their nature, *named* arguments can be provided one or
more times:

```text
& gitignore-template-generator rust --timeout 10
& gitignore-template-generator -g /test1 python java rust -g /test2
```

Last line in above example is just to showcase the possibility of providing
a named argument multiple times, but is not valid in the context of
**gitignore-template-generator**.

Last but not least, options specified using their short naming can be combined
through one single dash (`-`) prefix:

```text
& gitignore-template-generator -ahVl
```

Which specifically comes in handy to combine multiple boolean options. 

#### Boolean options

They constitute a special case of *named* arguments. They act as flag-like
options. Specifying them triggers their underlying function.

In the below example, wherever the option is placed, its underlying flag will
be enabled:

```text
& gitignore-template-generator --list
& gitignore-template-generator rust pyth --check javaa
```

Also, since they are **boolean** and behave like flags, they are not supposed
to take any values:

```text
$ gitignore-template-generator rust pytho --check="true"
error: unexpected value 'true' for '--check' found; no more were expected

Usage: gitignore-template-generator --check [TEMPLATE_NAMES]...

For more information, try '--help'.
```

## CLI options

All the supported CLI options are optional, and the
[list of general rules](#general-rules) described above applies to all of them.

- [-c --check]#-c-check
- [-g --generator-uri]#-g-generator-uri
- [-l --list]#-l-list
- [-i --lister-uri]#-i-lister-uri
- [-s --server-url]#-s-server-url
- [-t --timeout]#-t-timeout
- [-u --timeout-unit]#-u-timeout-unit
- [-h --help]#-h-help
- [-V --version]#-V-version
- [-a --author]#-a-author

### -c --check

This option is a **boolean** option that, when set, enables robust template
names check, meaning it will ensure that all provided template names are
valid (i.e. supported by the template manager service):

```text
& gitignore-template-generator rust pyth javaa --check
Following template names are not supported: pyth, javaa.
For the list of available template names, try '--list'.
```

Behind the scene, the template lister service, as pointed to by the
[-i --lister-uri](#-i-lister-uri) option, will be called to check for any
unsupported template names, thus, a slight overhead might be expected.

This option comes in handy whenever the underlying template manager service does
not provide meaningful error message for invalid template names, and you want
to ensure all provided values are valid.

With the default template manager service (i.e. `toptal`), a **404**
is returned for invalid template names, but no meaningful error message. So,
without the `-c/--check` option, the resulting output would be:

```text
& gitignore-template-generator rust pyth javaa
An error occurred during the API call: http status: 404
```

Naturally, this option cannot be provided without positional arguments:

```text
$ gitignore-template-generator --check
error: the following required arguments were not provided:
  <TEMPLATE_NAMES>...

Usage: gitignore-template-generator --check <TEMPLATE_NAMES>...

For more information, try '--help'.
```

And cannot be specified multiple times:

```text
$ gitignore-template-generator rust pyth javaa --check --check
error: the argument '--check' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

### -g --generator-uri

This option allows you to set a custom template generator uri. It takes a string
value and defaults to `/developers/gitignore/api` if not provided, which
corresponds to the gitignore template generator uri of `toptal` service:

```text
$ gitignore-template-generator rust python --generator-uri /developers/gitignore/api
# ...
# some rust python template
# ...
```

This endpoint takes one path parameter as defined in
`/developers/gitignore/api/{templateNames}`, with
`{templateNames}` being a comma-separated list of template names.

It isn't really useful when used alone, as default template manager service is
`toptal`, which only supports `/developers/gitignore/api` uri to generate
gitignore templates. But it comes in handy in combination with
the [-s --server-url](#-s-server-url) option, as it allows you to make it
point to some custom API:

```text
$ gitignore-template-generator rust python \
    --generator-uri /gitignore/generate \
    --server-url https://myapis.foobar.com
```

Naturally, this option cannot be provided without positional arguments:

```text
$ gitignore-template-generator --generator-uri /developers/gitignore/api
error: the following required arguments were not provided:
  <TEMPLATE_NAMES>...

Usage: gitignore-template-generator --generator-uri <GENERATOR_URI> <TEMPLATE_NAMES>...

For more information, try '--help'.
```

It must also start with a slash (`/`):

```text
$ gitignore-template-generator --generator-uri developers/gitignore/api
error: invalid value 'developers/gitignore/api' for '[GENERATOR_URI]...': URIs must start a slash (/)

For more information, try '--help'.
```

And cannot be specified multiple times:

```text
$ gitignore-template-generator rust python --generator-uri /developers/gitignore/api --generator-uri /developers/gitignore/api
error: the argument '--generator-uri <GENERATOR_URI>' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

Moreover, depending on how the underlying template manager service handles
undefined endpoints, if an undefined uri is provided, the resulting output
would usually be:

```text
$ gitignore-template-generator rust -generator-uri /foo
An error occurred during the API call: http status: 404
```

### -l --list

This option is a **boolean** option that, when set, will list all the available
template names:

```text
$ gitignore-template-generator --list
template1
template2
template3
template4
...
```

It will be listed one per line, which makes it really useful in combination with
less or grep:

```text
$ gitignore-template-generator --list | grep ja
django
jabref
janet
java
ninja
$ gitignore-template-generator --list | less
# in some interactive prompt
...
template1
template2
template3
template4
...
:
```

Behind the scene, it calls the template lister service as pointed to by the
[-i --lister-uri](#-i-lister-uri) option.

And it cannot be specified multiple times:

```text
$ gitignore-template-generator --list --list
error: the argument '--list' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

If the following options are provided and this option is set, they will be
skipped:

- [-c --check]#-c-check
- [-g --generator-uri]#-g-generator-uri

Same applies to positional arguments, if some are given, and this option is
set, they will be skipped.

### -i --lister-uri

This option allows you to set a custom template lister uri. It takes a string
value and defaults to `/developers/gitignore/api/list` if not provided, which
corresponds to the gitignore template lister uri of `portal` service:

```text
$ gitignore-template-generator --list --lister-uri /developers/gitignore/api/list
template1
template2
template3
template4
...
```

Of course, this option only makes sense in the context of
[-l --list](#-l-list) or [-c --check](#-c-check) options. With the later
coming from the fact that robust template names check relies on the lister
service.

Moreover, it isn't really useful when used alone, as default template manager
service is `toptal`, which only supports `/developers/gitignore/api/list` uri to
list available gitignore templates. But it comes in handy in combination with
the [-s --server-url](#-s-server-url) option, as it allows you to make it
point to some custom API:

```text
$ gitignore-template-generator --list \
    --lister-uri /gitignore/list \
    --server-url https://myapis.foobar.com
```

If we take a more complex example, one could combine this option with template
generation-related options to get a gitignore template with robust template
names check using a custom API:

```text
$ gitignore-template-generator rust pyth java --check \
    --lister-uri /gitignore/list \
    --generator-uri /gitignore/generate \
    --server-url https://myapis.foobar.com
```

Naturally, this option cannot be provided without positional arguments:

```text
$ gitignore-template-generator --lister-uri /developers/gitignore/api/list
error: the following required arguments were not provided:
  <TEMPLATE_NAMES>...

Usage: gitignore-template-generator --lister-uri <LISTER_URI> <TEMPLATE_NAMES>...

For more information, try '--help'.
```

It must also start with a slash (`/`):

```text
$ gitignore-template-generator --lister-uri developers/gitignore/api/list
error: invalid value 'developers/gitignore/api/list' for '[GENERATOR_URI]...': URIs must start a slash (/)

For more information, try '--help'.
```

And cannot be specified multiple times:

```text
--list --lister-uri /developers/gitignore/api/list
$ gitignore-template-generator --list --lister-uri /developers/gitignore/api/list --lister-uri /developers/gitignore/api/list
error: the argument '--lister-uri <LISTER_URI>' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

Moreover, depending on how the underlying template manager service handles
undefined endpoints, if an undefined uri is provided, the resulting output
would usually be:

```text
$ gitignore-template-generator --list --lister-uri /foo
An error occurred during the API call: http status: 404
```

Same result would happen if template generation with robust template names check
enabled:

```text
$ gitignore-template-generator rust pyth --check --lister-uri /foo
An error occurred during the API call: http status: 404
```

### -s --server-url

This option allows you to set a custom template manager base url. It takes a string
value and defaults to `https://www.toptal.com` if not provided, which
corresponds to the `toptal` base url, where their gitignore template generation
service is hosted:

```text
$ gitignore-template-generator rust python --server-url https://myapis.foobar.com
# ...
# some rust python template
# ...
```

It comes in handy if you want the tool to use your own custom gitignore
template generation service. And is pretty useful when combined with
[-g --generator-uri](#-g-generator-uri) or [-i --lister-uri](#-i-lister-uri)
options, as it allows to customize the hit endpoint uris, unless you rely on
the defaults.

Naturally, this option cannot be provided without positional arguments:

```text
$ gitignore-template-generator --server-url https://myapis.foobar.com
error: the following required arguments were not provided:
  <TEMPLATE_NAMES>...

Usage: gitignore-template-generator --server-url <SERVER_URL> <TEMPLATE_NAMES>...

For more information, try '--help'.
```

It must also be a valid URL:

```text
$ gitignore-template-generator --server-url htps:/myapis.foobar.com
error: invalid value 'htps:/myapis.foobar.com' for '[SERVER_URL]...': Value must be a valid URL

For more information, try '--help'.
```

And cannot be specified multiple times:

```text
--list --lister-uri /developers/gitignore/api/list
$ gitignore-template-generator rust python --server-url https://myapis.foobar.com --server-url https://myapis.foobar.com
error: the argument '--server-url <SERVER_URL>' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

Moreover, if an inexistent server is provided, the result would be:

```text
$ gitignore-template-generator rust python --server-url https://myapis.foobar.com
An error occurred during the API call: io: failed to lookup address information: Name or service not known
```

### -t --timeout

This option allows you to change the service calls timeout. It takes an unsigned
integer value and, if not provided, conditionally defaults to `5` if
[-u --timeout-unit](#-u-timeout-unit) is set to `second` (i.e. 5 seconds),
else to `5000` (i.e. 5000 milliseconds):

```text
$ gitignore-template-generator rust python --timeout 4
# ...
# some rust python template
# ...
```

The default value is conditionally assigned in order to prevent timeout issues
if [-u --timeout-unit](#-u-timeout-unit) is set to `millisecond` alone:

```text
$ gitignore-template-generator rust python --timeout-unit millisecond
# ...
# some rust python template
# ...
```

This option comes in handy to limit polling time if the generator is really
way too slow, or some maximum timeout limit must be complied with.

Naturally, this option cannot be provided without positional arguments:

```text
$ gitignore-template-generator --timeout 4
error: the following required arguments were not provided:
  <TEMPLATE_NAMES>...

Usage: gitignore-template-generator --timeout <TIMEOUT> <TEMPLATE_NAMES>...

For more information, try '--help'.
```

It must also be a positive integer:

```text
$ gitignore-template-generator --timeout dd
error: invalid value 'dd' for '--timeout <TIMEOUT>': invalid digit found in string

For more information, try '--help'.
$ gitignore-template-generator --timeout="-1"
error: invalid value '-1' for '--timeout <TIMEOUT>': invalid digit found in string

For more information, try '--help'.
```

And cannot be specified multiple times:

```text
$ gitignore-template-generator rust python --timeout 4 --timeout 6
error: the argument '--timeout <TIMEOUT>' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

### -u --timeout-unit

This option allows you to change the timeout unit. It takes a string value
among `[second, millisecond]` and defaults to `second` if not provided:

```text
$ gitignore-template-generator rust python --timeout-unit millisecond
# ...
# some rust python template
# ...
```

It isn't really useful when used alone, but comes pretty useful in combination
with [-t --timeout](#-t-timeout) option if you prefer to work with millisecond
units instead of seconds.

Naturally, this option cannot be provided without positional arguments:

```text
$ gitignore-template-generator --timeout-unit millisecond
error: the following required arguments were not provided:
  <TEMPLATE_NAMES>...

Usage: gitignore-template-generator --timeout-unit <TIMEOUT_UNIT> <TEMPLATE_NAMES>...

For more information, try '--help'.
```

It must be set to a valid value from supported set (`[second, millisecond]`):

```text
$ gitignore-template-generator rust python --timeout-unit millisecondd
error: invalid value 'millisecondd' for '--timeout-unit <TIMEOUT_UNIT>'
  [possible values: millisecond, second]

For more information, try '--help'.
```

And cannot be specified multiple times:

```text
$ gitignore-template-generator rust python --timeout-unit millisecond --timeout-unit second
error: the argument '--timeout-unit <TIMEOUT_UNIT>' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

### -h --help

This option is a preemptive **boolean** option that, when set, will display
a help message, listing you available options with short description for
each:

```text
$ gitignore-template-generator --help
# ...
# help output
# ...
```

By being preemptive, it means any other arguments, either *named* or *positional*,
will be skipped:

```text
$ gitignore-template-generator rust python \
    --check
    --lister-uri /foo
    --generator-uri /bar
    --server-url https://myapis.foobar.com
    --help
# ...
# help output
# ...
```

It's a special kinda *default* option coming from virtually all cli tools,
along with [-V --version](#-V-version) and [-a --author](#-a-author) options.

It has precedence over [-V --version](#-V-version) and [-a --author](#-a-author)
options if specified along:

```text
$ gitignore-template-generator -hVa
# ...
# help output
# ...
```

And cannot be specified multiple times:

```text
$ gitignore-template-generator rust python -hh
error: the argument '--help' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

### -V --version

This option is a preemptive **boolean** option that, when set, will display
version information:

```text
$ gitignore-template-generator --version
gitignore-template-generator 0.14.5
```

By being preemptive, it means any other arguments, either *named* or
*positional*, will be skipped:

```text
$ gitignore-template-generator rust python \
    --version
    --lister-uri /foo
    --generator-uri /bar
    --server-url https://myapis.foobar.com
    --help
gitignore-template-generator 0.14.5
```

It's a special kinda *default* option coming from virtually all cli tools,
along with [-h --help](#-h-help) and [-a --author](#-a-author) options.

It has precedence over [-a --author](#-a-author) options if specified along:

```text
$ gitignore-template-generator -Va
gitignore-template-generator 0.14.5
```

And cannot be specified multiple times:

```text
$ gitignore-template-generator -VV
error: the argument '--version' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```

### -a --author

This option is a preemptive **boolean** option that, when set, will display
author information:

```text
$ gitignore-template-generator --version
Patacode <pata.codegineer@gmail.com>
```

By being preemptive, it means any other arguments, either *named* or
*positional*, will be skipped:

```text
$ gitignore-template-generator rust python \
    --author
    --lister-uri /foo
    --generator-uri /bar
    --server-url https://myapis.foobar.com
    --help
Patacode <pata.codegineer@gmail.com>
```

It's a special kinda *default* option coming from virtually all cli tools,
along with [-h --help](#-h-help) and [-V --version](#-V-version) options.

And it cannot be specified multiple times:

```text
$ gitignore-template-generator -aa
error: the argument '--author' cannot be used multiple times

Usage: gitignore-template-generator [OPTIONS] [TEMPLATE_NAMES]...

For more information, try '--help'.
```