diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-03-21 21:56:15 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-03-23 16:25:12 +0300 |
commit | 51e1d64dccf4967eb078858529a0d7f05b8b461e (patch) | |
tree | e8314c5d2ece0964f828dedb203465e79d5a634b /bdep/new.cli | |
parent | bba28902195a9aceb987d474cf2004d034932533 (diff) |
Add --post-hook option to bdep-new
Diffstat (limited to 'bdep/new.cli')
-rw-r--r-- | bdep/new.cli | 66 |
1 files changed, 62 insertions, 4 deletions
diff --git a/bdep/new.cli b/bdep/new.cli index 8f64e8f..1e206df 100644 --- a/bdep/new.cli +++ b/bdep/new.cli @@ -81,8 +81,8 @@ namespace bdep $ bdep init -C @gcc cc config.cxx=g++ \ - After executing these commands the \c{hello} project will contain two - packages, \c{libhello} and \c{hello}. + After executing these commands the \cb{hello} project will contain two + packages, \cb{libhello} and \cb{hello}. The \cb{--subdirectory} form operates \i{as-if} by first creating according to <spec> a temporary project called <name> and then copying @@ -102,8 +102,8 @@ namespace bdep $ bdep init -C @gcc cc config.cxx=g++ \ - After executing these commands the \c{hello} project will contain two - source subdirectories, \c{libhello/} and \c{hello/}. + After executing these commands the \cb{hello} project will contain two + source subdirectories, \cb{libhello/} and \cb{hello/}. The project parameters such as type (executable, library, etc), language, and version control system can be customized as described next. Some of @@ -265,6 +265,18 @@ namespace bdep \li|\cb{none} Don't initialize a version control system inside the project.|| + + The newly created project, package, or subdirectory can be further + customized using the post-creation hooks specified with the + \cb{--post-hook} option. The hook commands are executed in the + newly created project, package, or source directory as their + current working directory. For example: + + \ + $ bdep new --post-hook \"echo .idea/ >>.gitignore\" hello + \ + + See the \cb{--post-hook} option documentation below for details. " } @@ -387,6 +399,52 @@ namespace bdep system-specific." } + strings --post-hook + { + "<command>", + "Run the specified command in the newly created project, package, or + source directory. + + The <command> value is interpreted as a whitespace-separated, + potentially quoted command line consisting of the program 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 'subdirectory' + @name@ - project, package, or subdirectory name + @base@ - name base (name without extension) + @stem@ - name stem (name base without 'lib' 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) + @root@ - project/package root directory + \ + + 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 |