aboutsummaryrefslogtreecommitdiff
path: root/bdep/new.cli
blob: 6b15840e5afc621c68b9a2ce893f51f5954e6dec (plain)
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
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
// file      : bdep/new.cli
// license   : MIT; see accompanying LICENSE file

include <bdep/project.cli>;
include <bdep/new-types.hxx>;

"\section=1"
"\name=bdep-new"
"\summary=create and initialize new project"

namespace bdep
{
  {
    "<options> <spec> <name>
     <type> <type-opt>
     <lang> <lang-opt>
     <vcs> <vcs-opt>
     <cfg-name> <cfg-dir>
     <prj-spec> <prj-dir>
     <cfg-args> <bpkg-options> <module> <cfg-var>",

    "\h|SYNOPSIS|

     \c{\b{bdep new} [<options>] [\b{--no-init}] <spec> [<name>]\n
        \b{bdep new} [<options>] \b{--config-add|-A} <cfg-dir> [\b{@}<cfg-name>] <spec> [<name>]\n
        \b{bdep new} [<options>] \b{--config-create|-C} <cfg-dir> [\b{@}<cfg-name>] <spec> [<name>]\n
        \ \ \ \ \ \ \ \ \ [<cfg-args>]\n
        \b{bdep new} [<options>] \b{--package} [<prj-spec>] <spec> [<name>]\n
        \b{bdep new} [<options>] \b{--source} [<prj-spec>] <spec> [<name>]}

     \c{<spec> \ \ \ \ = [<lang>] [<type>] [<vcs>]\n
        <lang> \ \ \ \ = \b{--lang}|\b{-l} (\b{c}|\b{c++})[\b{,}<lang-opt>...]\n
        <type> \ \ \ \ = \b{--type}|\b{-t} (\b{exe}|\b{lib}|\b{bare}|\b{empty})[\b{,}<type-opt>...]\n
        <vcs> \ \ \ \ \ = \b{--vcs}|\b{-s} \ (\b{git}|\b{none})[\b{,}<vcs-opt>...]\n
        <prj-spec> = \b{--directory}|\b{-d} <prj-dir>\n
        <cfg-args> = [\b{--} <bpkg-options>] [\b{--existing}|\b{-e} | (<module> | <cfg-var>)...]}

     \h|DESCRIPTION|

     The \cb{new} command creates and initializes a new project (the first
     three forms), a new package in an already existing project (the
     \cb{--package} form), or a new source subdirectory in an already existing
     project/package (the \cb{--source} form). All the forms except
     \cb{--source} first create according to <spec> a new \cb{build2}
     project/package called <name> in the <name> subdirectory of the current
     working directory (unless overridden with \c{\b{--output-dir}|\b{-o}}).

     The first form then, unless the \cb{--no-init} option is specified,
     initializes an empty project database as if by executing the
     \l{bdep-init(1)} command with the \cb{--empty} option. For example:

     \
     $ bdep new -l c++ -t exe hello

     $ tree hello/
     hello/
     ├── hello/
     │   ├── hello.cxx
     │   └── buildfile
     ├── buildfile
     └── manifest
     \

     Similarly, the second and third forms add an existing or create a new
     build configuration and then initialize the project in that configuration
     as if by executing the \l{bdep-init(1)} command with the
     \cb{--config-add} or \cb{--config-create} option, respectively. For
     example:

     \
     $ bdep new -l c++ -t exe -C @gcc hello cc config.cxx=g++
     \

     The \cb{--package} form adds the new package to the
     \cb{packages.manifest} file creating it if necessary. If no project
     directory is explicitly specified with \c{\b{--directory}|\b{-d}}, then
     the current working directory is assumed. Note that nested packages are
     not allowed. For example:

     \
     $ bdep new -t empty hello
     $ cd hello

     $ bdep new --package -l c++ -t lib libhello
     $ bdep new --package -l c++ -t exe hello

     $ bdep init -C @gcc cc config.cxx=g++

     $ cd ..
     $ tree hello/
     hello/
     ├── hello/
     │   ├── hello/
     │   │   ├── hello.cxx
     │   │   └── buildfile
     │   ├── buildfile
     │   └── manifest
     ├── libhello/
     │   ├── libhello/
     │   │   ├── hello.hxx
     │   │   ├── hello.cxx
     │   │   └── buildfile
     │   ├── buildfile
     │   └── manifest
     └── packages.manifest
     \

     The \cb{--source} form operates \i{as-if} by first creating according to
     <spec> a temporary project called <name> and then copying its source
     subdirectory (\c{\i{name}\b{/}\i{name}\b{/}} by default) over to the
     current working directory (unless overridden with
     \c{\b{--output-dir}|\b{-o}}). If no project/package directory is
     explicitly specified with \c{\b{--directory}|\b{-d}}, then the current
     working directory is assumed. For example:

     \
     $ bdep new -l c++ -t bare hello
     $ cd hello

     $ bdep new --source -l c++ -t lib libhello
     $ bdep new --source -l c++ -t exe hello

     $ bdep init -C @gcc cc config.cxx=g++

     $ cd ..
     $ tree hello/
     hello/
     ├── hello/
     │   ├── hello.cxx
     │   └── buildfile
     ├── libhello/
     │   ├── hello.hxx
     │   ├── hello.cxx
     │   └── buildfile
     ├── buildfile
     └── manifest
     \

     In all the forms, if <name> is omitted, then the current working
     directory name (unless overridden with \c{\b{--output-dir}|\b{-o}}) is
     used as the project/package/source subdirectory name. See
     \l{bpkg#package-name Package Name} for details on project/package names.

     The source subdirectory can be customized with the \cb{subdir} project
     type sub-option (see below for details). For example:

     \
     $ bdep new -l c++ -t lib,subdir=libhello/io libhello-io

     $ tree libhello-io/
     libhello-io/
     └── libhello/
         └── io/
             ├── hello-io.hxx
             └── hello-io.cxx
     \

     By default the source subdirectory is created in the project/package root
     directory and contains both headers (including public headers for
     libraries) as well as sources. This can be customized in a number of ways
     using the \cb{prefix*} and \cb{split} project type sub-options (see below
     for details). For example, to move the source subdirectory inside
     \c{src/}:

     \
     $ bdep new -l c++ -t exe,prefix=src hello

     $ tree hello/
     hello/
     └── src/
         └── hello/
             └── hello.cxx
     \

     And to split the library source subdirectory into public headers and
     other source files:

     \
     $ bdep new -l c++ -t lib,split libhello

     $ tree libhello/
     libhello/
     ├── include/
     │   └── libhello/
     │       └── hello.hxx
     └── src/
         └── libhello/
             └── hello.cxx
     \

     See the SOURCE LAYOUT section below for details and more examples.

     The output directory may already contain existing files provided they
     don't clash with the files to be created. The \cb{new} command also
     recognizes certain well-known files and tries to use the extracted
     information in the package \cb{manifest} file. Specifically, it tries to
     guess the license from the \cb{LICENSE} file as well as extract the
     summary from \cb{README.md}. This allows for the following workflow:

     \
     # Create a project with LICENSE and README.md on one of the Git
     # hosting services (GitHub, GitLab, etc).

     $ git clone .../libhello.git
     $ cd libhello

     $ bdep new -l c++ -t lib
     \

     The project parameters such as language, type (executable, library, etc),
     and version control system can be customized as described next. Some of
     these parameters also support parameter-specific sub-options (such as the
     file extensions to use in a C++ project) that can be specified with a
     comma after the parameter value.

     The project language can be specified with the \c{\b{--lang}|\b{-l}}
     option. Valid values for this option and their semantics are described
     next. If unspecified, a C++ project is created by default.

     \dl|

     \li|\cb{c}

         A C project.||

     \dl|

     \li|\cb{c++}

         A C++ project. Recognized language sub-options:|

     \li|\n\ \ \ \cb{cpp}

         Use the \cb{.cpp}, \cb{.hpp}, \cb{.ipp}, \cb{.tpp}, and \cb{.mpp}
         source file extensions (alias for \cb{extension=?pp}).|

     \li|\n\ \ \ \c{\b{extension=}\i{pattern}}

         Derive source file extensions from \ci{pattern} by replacing
         every \cb{?} with one of the \cb{c} (source), \cb{h} (header),
         \cb{i} (inline), \cb{t} (template), or \cb{m} (module interface)
         letters. If unspecified and no individual extensions are specified
         with the below options, then \cb{?xx} is used by default.|

     \li|\n\ \ \ \c{\b{hxx=}\i{extension}}

         Use the specified \ci{extension} for header files instead of
         the default \cb{.hxx}.|

     \li|\n\ \ \ \c{\b{cxx=}\i{extension}}

         Use the specified \ci{extension} for source files instead of
         the default \cb{.cxx}.|

     \li|\n\ \ \ \c{\b{ixx=}\i{extension}}

         Use the specified \ci{extension} for inline files. If
         unspecified, then assume no inline files are used by the
         project.|

     \li|\n\ \ \ \c{\b{txx=}\i{extension}}

         Use the specified \ci{extension} for template files. If
         unspecified, then assume no template files are used by the
         project.|

     \li|\n\ \ \ \c{\b{mxx=}\i{extension}}

         Use the specified \ci{extension} for module interface files. If
         unspecified, then assume no modules are used by the project.||

     As an example, the following command creates a header-only C++ library
     that uses the \cb{.h} extension for header files and \cb{.cpp} \- for
     source files:

     \
     $ bdep new -l c++,hxx=h,cxx=cpp -t lib,binless libhello
     \

     The project type can be specified with the \c{\b{--type}|\b{-t}} option.
     The \cb{empty} project type is language-agnostic with the semantics and
     valid sub-options for the rest being language-dependent, as described
     next. If unspecified, an executable project is created by default.

     \dl|

     \li|\cb{exe}

         A project that builds a sample C or C++ executable. Recognized
         executable project sub-options:|

     \li|\n\ \ \ \cb{no-tests}

         Don't add support for functional/integration testing.|

     \li|\n\ \ \ \cb{unit-tests}

         Add support for unit testing.|

     \li|\n\ \ \ \cb{no-install}

         Don't add support for installing.|

     \li|\n\ \ \ \c{\b{prefix=}\i{dir}}

         Optional source prefix relative to project/package root.|

     \li|\n\ \ \ \c{\b{subdir=}\i{dir}}

         Alternative source subdirectory relative to source prefix.|

     \li|\n\ \ \ \cb{no-subdir}

         Omit the source subdirectory.|

     \li|\n\ \ \ \c{\b{license=}\i{name}}|

     \li|\ \ \ \cb{no-readme}|

     \li|\ \ \ \cb{alt-naming}

         See \cb{common} sub-options below.||

     \dl|

     \li|\cb{lib}

         A project that builds a sample C or C++ library. Recognized library
         project sub-options:|

     \li|\n\ \ \ \cb{binless}

         Create a header-only C++ library.|

     \li|\n\ \ \ \cb{no-tests}

         Don't add support for functional/integration testing.|

     \li|\n\ \ \ \cb{unit-tests}

         Add support for unit testing.|

     \li|\n\ \ \ \cb{no-install}

         Don't add support for installing.|

     \li|\n\ \ \ \cb{no-version}

         Don't add support for generating the version header.|

     \li|\n\ \ \ \c{\b{prefix-include=}\i{dir}}

         Optional public header prefix relative to project/package root.|

     \li|\n\ \ \ \c{\b{prefix-source=}\i{dir}}

         Optional source prefix relative to project/package root.|

     \li|\n\ \ \ \c{\b{prefix=}\i{dir}}

         Shortcut for \c{\b{prefix-include=}\i{dir}\b{,prefix-source=}\i{dir}}.|

     \li|\n\ \ \ \cb{split}

         Shortcut for \cb{prefix-include=include,prefix-source=src}.|

     \li|\n\ \ \ \c{\b{subdir=}\i{dir}}

         Alternative source subdirectory relative to header/source prefix.|

     \li|\n\ \ \ \cb{no-subdir}

         Omit the source subdirectory.|

     \li|\n\ \ \ \cb{no-subdir-source}

         Omit the source subdirectory relative to the source prefix but still
         create it relative to the header prefix.|

     \li|\n\ \ \ \c{\b{license=}\i{name}}|

     \li|\ \ \ \cb{no-readme}|

     \li|\ \ \ \cb{alt-naming}

         See \cb{common} sub-options below.||

     \dl|

     \li|\cb{bare}

         A project without any source code that can be filled later
         (see \cb{--source}). Recognized bare project sub-options:|

     \li|\n\ \ \ \cb{no-tests}

         Don't add support for testing.|

     \li|\n\ \ \ \cb{no-install}

         Don't add support for installing.|

     \li|\n\ \ \ \c{\b{license=}\i{name}}|

     \li|\ \ \ \cb{no-readme}|

     \li|\ \ \ \cb{alt-naming}

         See \cb{common} sub-options below.||

     \dl|

     \li|\cb{empty}

         An empty project that can be filled with packages (see
         \cb{--package}). Recognized empty project sub-options:|

     \li|\n\ \ \ \cb{no-readme}

         See \cb{common} sub-options below.||

     \dl|

     \li|\cb{common}

         Common project type sub-options:|

     \li|\n\ \ \ \c{\b{license=}\i{name}}

         Specify the project's license. The license name can be an
         \l{https://spdx.org/licenses/ SPDX License Expression}, which, in its
         simplest form, is just the license ID. Or it can be a free form name
         in the \cb{other:} license name scheme. If unspecified, then
         \cb{other: proprietary} is assumed. The following tables lists the
         most commonly used free/open source software license IDs as well as a
         number of pre-defined \cb{other:} names. See the
         \l{bpkg#manifest-package-license \cb{license}} package manifest value
         for more information.

         \
         MIT                MIT License.

         BSD-2-Clause       BSD 2-Clause \"Simplified\" License
         BSD-3-Clause       BSD 3-Clause \"New\" or \"Revised\" License

         GPL-3.0-only       GNU General Public License v3.0 only
         GPL-3.0-or-later   GNU General Public License v3.0 or later

         LGPL-3.0-only      GNU Lesser General Public License v3.0 only
         LGPL-3.0-or-later  GNU Lesser General Public License v3.0 or later

         AGPL-3.0-only      GNU Affero General Public License v3.0 only
         AGPL-3.0-or-later  GNU Affero General Public License v3.0 or later

         Apache-2.0         Apache License 2.0

         MPL-2.0            Mozilla Public License 2.0

         BSL-1.0            Boost Software License 1.0

         Unlicense          The Unlicense (public domain)
         \

         \
         other: public domain     Released into the public domain
         other: available source  Not free/open source with public source code
         other: proprietary       Not free/open source
         other: TODO              License is not yet decided
         \

         |

     \li|\n\ \ \ \cb{no-readme}

         Don't add \cb{README.md}.|

     \li|\n\ \ \ \cb{alt-naming}

         Use the alternative build file/directory naming scheme.||

     The project version control system can be specified with the
     \c{\b{--vcs}|\b{-s}} option. Valid values for this option and their
     semantics are described next. If unspecified, \cb{git} is assumed by
     default.

     \dl|

     \li|\cb{git}

         Initialize a \cb{git(1)} repository inside the project and generate
         \cb{.gitignore} files.||

     \dl|

     \li|\cb{none}

         Don't initialize a version control system inside the project.||

     The created project, package, or source subdirectory can be further
     customized using the pre and post-creation hooks specified with the
     \cb{--pre-hook} and \cb{--post-hook} options, respectively. The pre hooks
     are executed before any new files are created and the post hook \- after
     all the files have been created. The hook commands are executed in the
     project, package, or source directory as their current working directory.
     For example:

     \
     $ bdep new --post-hook \"echo .idea/ >>.gitignore\" hello
     \

     The pre hooks are primarily useful for moving/renaming existing files
     that would otherwise clash with files created by the \cb{new}
     command. For example:

     \
     $ bdep new --pre-hook  \"mv .gitignore .gitignore.bak\" \\
                --post-hook \"cat .gitignore.bak >>.gitignore\" \\
                --post-hook \"rm .gitignore.bak\" ...
     \

     See the \cb{--pre-hook} and \cb{--post-hook} options documentation below
     for details.
     "
  }

  // --lang options
  //
  class cmd_new_c_options
  {
  };

  // The cpp flag is the "extension=?pp" alias and is mutually exclusive with
  // extension=.
  //
  class cmd_new_cxx_options
  {
    bool cpp;
    string extension;
    string hxx;
    string cxx;
    string ixx;
    string txx;
    string mxx;
  };

  //--type options
  //
  // Note that we only support combined executable source layouts.
  //
  class cmd_new_exe_options
  {
    bool no-tests;
    bool unit-tests;
    bool no-install;
    dir_path prefix;
    dir_path subdir;
    bool no-subdir;
    string license = "other: proprietary";
    bool no-readme;
    bool alt-naming;

    // Old name for the subdir sub-option (thus undocumented).
    //
    // If specified, we will fail suggesting to use the new sub-option instead.
    //
    dir_path "source";
  };

  class cmd_new_lib_options
  {
    bool binless;
    bool no-tests;
    bool unit-tests;
    bool no-install;
    bool no-version;
    dir_path prefix-source;
    dir_path prefix-include;
    dir_path prefix;
    bool split;
    dir_path subdir;
    bool no-subdir;
    bool no-subdir-source;
    string license = "other: proprietary";
    bool no-readme;
    bool alt-naming;

    // Old name for the subdir sub-option (thus undocumented).
    //
    // If specified, we will fail suggesting to use the new sub-option instead.
    //
    dir_path "source";
  };

  class cmd_new_bare_options
  {
    bool no-tests;
    bool no-install;
    string license = "other: proprietary";
    bool no-readme;
    bool alt-naming;
  };

  class cmd_new_empty_options
  {
    bool no-readme;
  };

  // --vcs options
  //
  class cmd_new_git_options
  {
  };

  class cmd_new_none_options
  {
  };

  class cmd_new_options: configuration_add_options, configuration_name_options
  {
    "\h|NEW OPTIONS|"

    bool --no-init
    {
      "Don't initialize an empty build configuration set."
    }

    bool --package
    {
      "Create a new package inside an already existing project rather than a
       new project."
    }

    bool --source
    {
      "Create a new source subdirectory inside an already existing project or
       package rather than a new project."
    }

    // Old name for the --source option (thus undocumented).
    //
    // If specified, we will fail suggesting to use the new option instead.
    //
    bool --subdirectory;

    dir_path --output-dir|-o
    {
      "<dir>",
      "Create the project, package, or source subdirectory in the specified
       directory."
    }

    dir_path --directory|-d
    {
      "<dir>",
      "Assume the project/package is in the specified directory rather than
       in the current working directory. Only used with \cb{--package} or
       \cb{--source}."
    }

    cmd_new_type --type|-t
    {
      "<type>[,<opt>...]",
      "Specify project type and options. Valid values for <type> are \cb{exe}
       (executable project, default), \cb{lib} (library project), \cb{bare}
       (bare project without any source code), and \cb{empty} (empty project
       ready to be filled with packages). Valid values for <opt> are
       type-specific."
    }

    cmd_new_lang --lang|-l
    {
      "<lang>[,<opt>...]",
      "Specify project language and options. Valid values for <lang> are \cb{c}
       and \cb{c++} (default). Valid values for <opt> are language-specific."
    }

    cmd_new_vcs --vcs|-s
    {
      "<vcs>[,<opt>...]",
      "Specify project version control system and options. Valid values for
       <vcs> are \cb{git} (default) and \cb{none}. Valid values for <opt> are
       system-specific."
    }

    strings --pre-hook
    {
      "<command>"
      // Shares documentation with --post-hook.
    }

    strings --post-hook
    {
      "<command>",
      "Run the specified command before/after creating the project, package, or
       source directory.

       The <command> value is interpreted as a whitespace-separated,
       potentially quoted command line consisting of a program or a portable
       \l{testscript#builtins builtin} optionally followed by arguments and
       redirects. Specifically, a single level of quotes (either single or
       double) is removed and whitespaces are not treated as separators inside
       such quoted fragments. Currently only the \cb{stdout} redirect to a
       file is supported. For example:

       \
       $ bdep new --post-hook \"echo '.idea/ # IDE' >>.gitignore\" hello
       \

       The command line elements (program, arguments, etc) may optionally
       contain substitutions \- variable names enclosed with the \cb{@}
       substitution symbol \- which are replaced with the corresponding
       variable values to produce the actual command. The following variable
       names are recognized with the double substitution symbol (\cb{@@})
       serving as an escape sequence.

       \
       @mode@ - one of 'project', 'package', or 'source'
       @name@ - project, package, or source subdirectory name
       @base@ - name base (name without extension)
       @stem@ - name stem (name base without 'lib' prefix)
       @root@ - project/package root directory
       @pfx@  - combined prefix relative to project/package root
       @inc@  - split header prefix relative to project/package root
       @src@  - split source prefix relative to project/package root
       @sub@  - source subdirectory relative to header/source prefix
       @type@ - type (--type|-t value: 'exe', 'lib', etc)
       @lang@ - language (--lang|-l value: 'c', 'c++', etc)
       @vcs@  - version control system (--vcs|-s value: 'git', etc)
       \

       Note that the \cb{@inc@} and \cb{@src@} variables are only set if the
       header/source prefix is split with the combined \cb{@pfx@} variable set
       otherwise.

       For example:

       \
       $ bdep new --post-hook \"echo bin/ >>@name@/.gitignore\" hello
       \

       These substitution variables are also made available to the hook program
       as the \cb{BDEP_NEW_*} environment variables (\cb{BDEP_NEW_MODE},
       \cb{BDEP_NEW_NAME}, etc)."
    }

    // @@ This should be a no-amalgamation type sub-options.
    //
    bool --no-amalgamation
    {
      "Create a project with disabled amalgamation support. This option is
       normally only used for testing."
    }

    bool --no-checks
    {
      "Suppress nested project/package checks. This option is normally only
       used for testing."
    }

    dir_path --config-add|-A
    {
      "<dir>",
      "Add an existing build configuration <dir>."
    }

    dir_path --config-create|-C
    {
      "<dir>",
      "Create a new build configuration in <dir>."
    }
  };

  "
   \h#src-layout|SOURCE LAYOUT|

   C and C++ projects employ a bewildering variety of source code layouts most
   of which fit into two broad classes: \i{combined}, where all the source
   code for a single executable or library resides in the same directory and
   \i{split}, where headers (typically public headers of a library) and other
   source files reside in separate directories (most commonly called
   \cb{include/} and \cb{src/}).

   To support the creation of such varying layouts the \cb{new} command
   divides paths leading to source code inside a package/project into a number
   of customizable components:

   \
   libhello/{include,src}/hello/
       ^         ^          ^
       |         |          |
    project/   source    source
    package    prefix  subdirectory
     root
   \

   Note that while the same physical layout can be achieved with various
   combinations of source prefix and subdirectory, there will be differences
   in semantics since the headers in the project are included with the source
   subdirectory (if any) as a prefix. See \l{intro#proj-struct Canonical
   Project Structure} for rationale and details.

   As we have already seen, the source subdirectory can be customized with the
   \cb{subdir} project type sub-option. For example:

   \
   # libhello/hello/

   $ bdep new -l c++ -t lib,subdir=hello libhello

   $ tree libhello/
   libhello/
   └── hello/
       ├── hello.hxx
       └── hello.cxx
   \

   Note: pass \cb{-l\ c++,cpp} if you prefer the \cb{.hpp}/\cb{.cpp} source
   file naming scheme.

   The source prefix can be combined, in which case it can be customized with
   the single \cb{prefix} project type sub-option. For example:

   \
   # hello/src/hello/

   $ bdep new -l c++ -t exe,prefix=src hello

   $ tree hello/
   hello/
   └── src/
       └── hello/
           └── hello.cxx
   \

   The prefix can also be split, in which case the \cb{prefix-include} and
   \cb{prefix-source} sub-options can be used to customize the respective
   directories independently. If either is omitted, then the corresponding
   prefix is left empty. For example:

   \
   # libhello/{include,.}/libhello/

   $ bdep new -l c++ -t lib,prefix-include=include libhello

   $ tree libhello/
   libhello/
   ├── include/
   │   └── libhello/
   │       └── hello.hxx
   └── libhello/
       └── hello.cxx
   \

   The \cb{split} sub-option is a convenient shortcut for the most common case
   where the header prefix is \cb{include/} and source prefix is \cb{src/}. For
   example:

   \
   # libhello/{include,src}/libhello/

   $ bdep new -l c++ -t lib,split libhello

   $ tree libhello/
   libhello/
   ├── include/
   │   └── libhello/
   │       └── hello.hxx
   └── src/
       └── libhello/
           └── hello.cxx
   \

   The source subdirectory can be omitted by specifying the \cb{no-subdir}
   project type sub-option. For example:

   \
   # hello/src/

   $ bdep new -l c++ -t exe,prefix=src,no-subdir hello

   $ tree hello/
   hello/
   └── src/
       └── hello.cxx
   \

   The same but for the split layout (we also have to disable the generated
   version header that is not supported in this layout):

   \
   # libhello/{include,src}/

   $ bdep new -l c++ -t lib,split,no-subdir,no-version libhello

   $ tree libhello/
   libhello/
   ├── include/
   │   └── hello.hxx
   └── src/
       └── hello.cxx
   \

   To achieve the layout where all the source code resides in the project
   root, we omit both the source prefix and subdirectory (we also have to
   disable a couple of other features that are not supported in this layout):

   \
   # hello/

   $ bdep new -l c++ -t lib,no-subdir,no-version,no-tests libhello

   $ tree libhello/
   libhello/
   ├── hello.cxx
   └── hello.hxx
   \

   We can also omit the source subdirectory but only in the source prefix of
   the split layout by specifying the \cb{no-subdir-source} sub-option. For
   example:

   \
   # libhello/{include/hello,src}/

   $ bdep new -l c++ -t lib,split,subdir=hello,no-subdir-source libhello

   $ tree libhello/
   libhello/
   ├── include/
   │   └── hello/
   │       └── hello.hxx
   └── src/
       └── hello.cxx
   \

   To achieve the split layout where the \cb{include/} directory is inside
   \cb{src/}:

   \
   # libhello/src/{include,.}/hello/

   $ bdep new                                                         \
     -l c++                                                           \
     -t lib,prefix-include=src/include,prefix-source=src,subdir=hello \
     libhello

   $ tree libhello/
   libhello/
   └── src/
       ├── include/
       │   └── hello/
       │       └── hello.hxx
       └── hello/
           └── hello.cxx
   \

   A similar layout but without the source subdirectory in \cb{src/}:

   \
   # libhello/src/{include/hello,.}/

   $ bdep new                                                         \
     -l c++                                                           \
     -t lib,prefix-include=src/include,prefix-source=src,\
   subdir=hello,no-subdir-source                                      \
     libhello

   $ tree libhello/
   libhello/
   └── src/
       ├── include/
       │   └── hello/
       │       └── hello.hxx
       └── hello.cxx
   \

   The layout used by the Boost libraries:

   \
   # libhello/{include/hello,libs/hello/src}/

   $ bdep new                                                         \
     -l c++                                                           \
     -t lib,prefix-include=include,prefix-source=libs/hello/src,\
   subdir=hello,no-subdir-source                                      \
     libhello

   $ tree libhello/
   libhello/
   ├── include/
   │   └── hello/
   │       └── hello.hxx
   └── libs/
       └── hello/
           └── src/
               └── hello.cxx
   \

   A layout where multiple components each have their own \cb{include/src}
   split:

   \
   # hello/libhello1/{include/hello1,src}/
   # hello/libhello2/{include/hello2,src}/

   $ bdep new -l c++ -t bare hello

   $ bdep new -d hello --source                                       \
     -l c++                                                           \
     -t lib,\
   prefix-include=libhello1/include,prefix-source=libhello1/src,\
   subdir=hello1,no-subdir-source                                     \
     libhello1

   $ bdep new -d hello --source                                       \
     -l c++                                                           \
     -t lib,\
   prefix-include=libhello2/include,prefix-source=libhello2/src,\
   subdir=hello2,no-subdir-source                                     \
     libhello2

   $ tree hello/
   hello/
   ├── libhello1/
   │   ├── include/
   │   │   └── hello1/
   │   │       └── hello1.hxx
   │   └── src/
   │       └── hello1.cxx
   └── libhello2/
       ├── include/
       │   └── hello2/
       │       └── hello2.hxx
       └── src/
           └── hello2.cxx
   \

   A layout where libraries and executables have different prefixes:

   \
   # hello/libs/libhello/{include/hello,src}/
   # hello/src/hello/

   $ bdep new -l c++ -t bare hello

   $ bdep new -d hello --source                                       \
     -l c++                                                           \
     -t lib,\
   prefix-include=libs/libhello/include,prefix-source=libs/libhello/src,\
   subdir=hello,no-subdir-source                                      \
     libhello

   $ bdep new -d hello --source -l c++ -t exe,prefix=src hello

   $ tree hello/
   hello/
   ├── libs/
   │   └── libhello/
   │       ├── include/
   │       │   └── hello/
   │       │       └── hello.hxx
   │       └── src/
   │           └── hello.cxx
   └── src/
       └── hello/
           └── hello.cxx
   \

   \h|DEFAULT OPTIONS FILES|

   See \l{bdep-default-options-files(1)} for an overview of the default
   options files. For the \cb{new} command the search start directory is the
   project directory in the package and source modes and the parent directory
   of the new project in all other modes. The following options files are
   searched for in each directory and, if found, loaded in the order listed:

   \
   bdep.options
   bdep-{config config-add}.options                # if --config-add|-A
   bdep-{config config-add config-create}.options  # if --config-create|-C
   bdep-new.options
   bdep-new-{project|package|source}.options # (mode-dependent)
   \

   The following \cb{new} command options cannot be specified in the
   default options files:

   \
   --output-dir|-o
   --directory|-d
   --package
   --source
   --no-checks
   --config-add|-A
   --config-create|-C
   --wipe
   \

   While the presence of the \cb{--pre-hook} or \cb{--post-hook} options in
   remote default options files will trigger a prompt.


   \h|ENVIRONMENT|

   The \cb{BDEP_AUTHOR_EMAIL} environment variable can be used to specify the
   package email address. If not set, the \cb{new} command will first try to
   obtain the email from the version control system (if used) and then from
   the \cb{EMAIL} environment variable. If all these methods fail, a dummy
   \cb{you@example.org} email is used.
  "
}