[1980] | 1 | # ------------------------------------------------------------------------------ |
---|
| 2 | # (C) Crown copyright Met Office. All rights reserved. |
---|
| 3 | # For further details please refer to the file COPYRIGHT.txt |
---|
| 4 | # which you should have received as part of this distribution. |
---|
| 5 | # ------------------------------------------------------------------------------ |
---|
| 6 | use strict; |
---|
| 7 | use warnings; |
---|
| 8 | |
---|
| 9 | package Fcm::CLI::Config::Default; |
---|
| 10 | |
---|
| 11 | use Fcm::CLI::Option; |
---|
| 12 | use Fcm::CLI::Subcommand; |
---|
| 13 | |
---|
| 14 | my %DESCRIPTION_OF = ( |
---|
| 15 | # -------------------------------------------------------------------------- |
---|
| 16 | BROWSER => <<'END_DESCRIPTION', |
---|
| 17 | If TARGET is specified, it must be a FCM URL keyword, a Subversion URL or the |
---|
| 18 | path to a local working copy. If not specified, the current working directory |
---|
| 19 | is assumed to be a working copy. If the --browser option is specified, the |
---|
| 20 | specified web browser command is used to launch the repository browser. |
---|
| 21 | Otherwise, it attempts to use the default browser from the configuration |
---|
| 22 | setting. |
---|
| 23 | END_DESCRIPTION |
---|
| 24 | # -------------------------------------------------------------------------- |
---|
| 25 | BUILD => <<'END_DESCRIPTION', |
---|
| 26 | The path to a CFGFILE may be provided. Otherwise, the build system searches the |
---|
| 27 | default locations for a bld cfg file. |
---|
| 28 | |
---|
| 29 | If no option is specified, the options "-s 5 -t all -j 1 -v 1" are assumed. |
---|
| 30 | |
---|
| 31 | If the option for full build is specified, the sub-directories created by |
---|
| 32 | previous builds will be removed, so that the current build can start cleanly. |
---|
| 33 | |
---|
| 34 | The -s option can be used to limit the actions performed by the build system up |
---|
| 35 | to a named stage. The stages are: |
---|
| 36 | "1", "s" or "setup" - stage 1, setup |
---|
| 37 | "2", "pp" or "pre_process" - stage 2, pre-process |
---|
| 38 | "3", "gd" or "generate_dependency" - stage 3, generate dependency |
---|
| 39 | "4", "gi" or "generate_interface" - stage 4, generate Fortran 9X interface |
---|
| 40 | "5", "m", "make" - stage 5, make |
---|
| 41 | |
---|
| 42 | If a colon separated list of targets is specified using the -t option, the |
---|
| 43 | default targets specified in the configuration file will not be used. |
---|
| 44 | |
---|
| 45 | If archive mode is switched on, build sub-directories that are only used in the |
---|
| 46 | build process will be archived to TAR files. The default is off. |
---|
| 47 | |
---|
| 48 | If specified, the verbose level must be an integer greater than 0. Verbose |
---|
| 49 | level 0 is the quiet mode. Increasing the verbose level will increase the |
---|
| 50 | amount of diagnostic output. |
---|
| 51 | |
---|
| 52 | When a build is invoked, it sets up a lock file in the build root directory. |
---|
| 53 | The lock is normally removed at the end of the build. While the lock file is in |
---|
| 54 | place, the build commands invoked in the same root directory will fail. If |
---|
| 55 | you need to bypass this check for whatever reason, you can invoke the build |
---|
| 56 | system with the --ignore-lock option. |
---|
| 57 | END_DESCRIPTION |
---|
| 58 | # -------------------------------------------------------------------------- |
---|
| 59 | CFG_PRINTER => <<'END_DESCRIPTION', |
---|
| 60 | If no option is specified, the output will be sent to standard output. |
---|
| 61 | END_DESCRIPTION |
---|
| 62 | # -------------------------------------------------------------------------- |
---|
| 63 | EXTRACT => <<'END_DESCRIPTION', |
---|
| 64 | The path to a CFG file may be provided. Otherwise, the extract system searches |
---|
| 65 | the default locations for an ext cfg file. |
---|
| 66 | |
---|
| 67 | If no option is specified, the system will attempt an incremental extract where |
---|
| 68 | appropriate. |
---|
| 69 | |
---|
| 70 | If specified, the verbose level must be an integer greater than 0. Verbose |
---|
| 71 | level 0 is the quiet mode. Increasing the verbose level will increase the |
---|
| 72 | amount of diagnostic output. |
---|
| 73 | |
---|
| 74 | When an extract is invoked, it sets up a lock file in the extract destination |
---|
| 75 | root directory. The lock is normally removed at the end of the extract. While |
---|
| 76 | the lock file is in place, other extract commands invoked in the same |
---|
| 77 | destination root directory will fail. If you need to bypass this check for |
---|
| 78 | whatever reason, you can invoke the extract system with the --ignore-lock |
---|
| 79 | option. |
---|
| 80 | END_DESCRIPTION |
---|
| 81 | # -------------------------------------------------------------------------- |
---|
| 82 | EXTRACT_CONFIG_COMPARATOR => <<'END_DESCRIPTION', |
---|
| 83 | Compares the extract configurations of two similar extract configuration files |
---|
| 84 | CFGFILE1 and CFGFILE2. |
---|
| 85 | |
---|
| 86 | In normal mode with verbosity level 2 or above, displays the change log of each |
---|
| 87 | revision. |
---|
| 88 | |
---|
| 89 | In wiki mode, print revision tables in wiki format. The argument to the --wiki |
---|
| 90 | option must be the Subversion URL or FCM URL keyword of a FCM project |
---|
| 91 | associated with the intended Trac system. The --verbose option has no effect |
---|
| 92 | in wiki mode. |
---|
| 93 | END_DESCRIPTION |
---|
| 94 | # -------------------------------------------------------------------------- |
---|
| 95 | GUI => <<'END_DESCRIPTION', |
---|
| 96 | The optional argument PATH modifies the initial working directory of the GUI. |
---|
| 97 | END_DESCRIPTION |
---|
| 98 | # -------------------------------------------------------------------------- |
---|
| 99 | KEYWORD => <<'END_DESCRIPTION', |
---|
| 100 | If no argument is specified, prints registered location keywords. Otherwise, |
---|
| 101 | prints the implied location keywords and revision keywords for the specified |
---|
| 102 | target. |
---|
| 103 | END_DESCRIPTION |
---|
| 104 | ); |
---|
| 105 | |
---|
| 106 | my %OPTION_OF = ( |
---|
| 107 | ARCHIVE => Fcm::CLI::Option->new({ |
---|
| 108 | name => 'archive', |
---|
| 109 | letter => 'a', |
---|
| 110 | description => 'archives sub-directories on success', |
---|
| 111 | }), |
---|
| 112 | |
---|
| 113 | BROWSER => Fcm::CLI::Option->new({ |
---|
| 114 | name => 'browser', |
---|
| 115 | letter => 'b', |
---|
| 116 | description => 'specifies the web browser command', |
---|
| 117 | has_arg => Fcm::CLI::Option->SCALAR_ARG, |
---|
| 118 | }), |
---|
| 119 | |
---|
| 120 | CLEAN => Fcm::CLI::Option->new({ |
---|
| 121 | name => 'clean', |
---|
| 122 | description => 'cleans the destination', |
---|
| 123 | }), |
---|
| 124 | |
---|
| 125 | FULL => Fcm::CLI::Option->new({ |
---|
| 126 | name => 'full', |
---|
| 127 | letter => 'f', |
---|
| 128 | description => 'runs in full mode', |
---|
| 129 | }), |
---|
| 130 | |
---|
| 131 | HELP => Fcm::CLI::Option->new({ |
---|
| 132 | name => 'help', |
---|
| 133 | letter => 'h', |
---|
| 134 | description => 'prints help', |
---|
| 135 | is_help => 1, |
---|
| 136 | }), |
---|
| 137 | |
---|
| 138 | IGNORE_LOCK => Fcm::CLI::Option->new({ |
---|
| 139 | name => 'ignore-lock', |
---|
| 140 | description => 'ignores lock file', |
---|
| 141 | }), |
---|
| 142 | |
---|
| 143 | JOBS => Fcm::CLI::Option->new({ |
---|
| 144 | name => 'jobs', |
---|
| 145 | letter => 'j', |
---|
| 146 | description => 'number of parallel jobs', |
---|
| 147 | has_arg => Fcm::CLI::Option->SCALAR_ARG, |
---|
| 148 | }), |
---|
| 149 | |
---|
| 150 | OUTPUT => Fcm::CLI::Option->new({ |
---|
| 151 | name => 'output', |
---|
| 152 | letter => 'o', |
---|
| 153 | description => 'sends output to the specified file', |
---|
| 154 | has_arg => Fcm::CLI::Option->SCALAR_ARG, |
---|
| 155 | }), |
---|
| 156 | |
---|
| 157 | STAGE => Fcm::CLI::Option->new({ |
---|
| 158 | name => 'stage', |
---|
| 159 | letter => 's', |
---|
| 160 | description => 'runs command up to a named stage', |
---|
| 161 | has_arg => Fcm::CLI::Option->SCALAR_ARG, |
---|
| 162 | }), |
---|
| 163 | |
---|
| 164 | TARGETS => Fcm::CLI::Option->new({ |
---|
| 165 | name => 'targets', |
---|
| 166 | letter => 't', |
---|
| 167 | delimiter => ':', |
---|
| 168 | description => 'list of build targets, delimited by (:)', |
---|
| 169 | has_arg => Fcm::CLI::Option->ARRAY_ARG, |
---|
| 170 | }), |
---|
| 171 | |
---|
| 172 | VERBOSITY => Fcm::CLI::Option->new({ |
---|
| 173 | name => 'verbose', |
---|
| 174 | letter => 'v', |
---|
| 175 | description => 'verbose level', |
---|
| 176 | has_arg => Fcm::CLI::Option->SCALAR_ARG, |
---|
| 177 | }), |
---|
| 178 | |
---|
| 179 | WIKI => Fcm::CLI::Option->new({ |
---|
| 180 | name => 'wiki', |
---|
| 181 | letter => 'w', |
---|
| 182 | description => 'print revision tables in wiki format', |
---|
| 183 | has_arg => Fcm::CLI::Option->SCALAR_ARG, |
---|
| 184 | }), |
---|
| 185 | ); |
---|
| 186 | |
---|
| 187 | my %SUBCOMMAND_OF = ( |
---|
| 188 | BRANCH => Fcm::CLI::Subcommand->new({ |
---|
| 189 | names => ['branch', 'br'], |
---|
| 190 | synopsis => 'branch utilities', |
---|
| 191 | invoker_class => 'Fcm::CLI::Invoker::CM', |
---|
| 192 | is_vc => 1, |
---|
| 193 | }), |
---|
| 194 | |
---|
| 195 | BROWSER => Fcm::CLI::Subcommand->new({ |
---|
| 196 | names => ['trac', 'www'], |
---|
| 197 | synopsis => 'invokes the browser for a version controlled target', |
---|
| 198 | usage => '[OPTIONS...] [TARGET]', |
---|
| 199 | description => $DESCRIPTION_OF{BROWSER}, |
---|
| 200 | invoker_class => 'Fcm::CLI::Invoker::Browser', |
---|
| 201 | options => [ |
---|
| 202 | $OPTION_OF{BROWSER}, |
---|
| 203 | $OPTION_OF{HELP}, |
---|
| 204 | ], |
---|
| 205 | }), |
---|
| 206 | |
---|
| 207 | BUILD => Fcm::CLI::Subcommand->new({ |
---|
| 208 | names => ['build', 'bld'], |
---|
| 209 | synopsis => 'invokes the build system', |
---|
| 210 | usage => '[OPTIONS...] [CFGFILE]', |
---|
| 211 | description => $DESCRIPTION_OF{BUILD}, |
---|
| 212 | invoker_class => 'Fcm::CLI::Invoker::ConfigSystem', |
---|
| 213 | invoker_config => { |
---|
| 214 | impl_class => 'Fcm::Build', |
---|
| 215 | cli2invoke_key_map => { |
---|
| 216 | 'archive' => 'ARCHIVE', |
---|
| 217 | 'clean' => 'CLEAN', |
---|
| 218 | 'full' => 'FULL', |
---|
| 219 | 'ignore-lock' => 'IGNORE_LOCK', |
---|
| 220 | 'jobs' => 'JOBS', |
---|
| 221 | 'stage' => 'STAGE', |
---|
| 222 | 'targets' => 'TARGETS', |
---|
| 223 | }, |
---|
| 224 | }, |
---|
| 225 | options => [ |
---|
| 226 | $OPTION_OF{ARCHIVE}, |
---|
| 227 | $OPTION_OF{CLEAN}, |
---|
| 228 | $OPTION_OF{FULL}, |
---|
| 229 | $OPTION_OF{HELP}, |
---|
| 230 | $OPTION_OF{IGNORE_LOCK}, |
---|
| 231 | $OPTION_OF{JOBS}, |
---|
| 232 | $OPTION_OF{STAGE}, |
---|
| 233 | $OPTION_OF{TARGETS}, |
---|
| 234 | $OPTION_OF{VERBOSITY}, |
---|
| 235 | ], |
---|
| 236 | }), |
---|
| 237 | |
---|
| 238 | CFG_PRINTER => Fcm::CLI::Subcommand->new({ |
---|
| 239 | names => ['cfg'], |
---|
| 240 | synopsis => 'invokes the CFG file pretty printer', |
---|
| 241 | usage => '[OPTIONS...] [CFGFILE]', |
---|
| 242 | description => $DESCRIPTION_OF{CFG_PRINTER}, |
---|
| 243 | invoker_class => 'Fcm::CLI::Invoker::CfgPrinter', |
---|
| 244 | options => [ |
---|
| 245 | $OPTION_OF{HELP}, |
---|
| 246 | $OPTION_OF{OUTPUT}, |
---|
| 247 | ], |
---|
| 248 | }), |
---|
| 249 | |
---|
| 250 | CM => Fcm::CLI::Subcommand->new({ |
---|
| 251 | names => [qw{ |
---|
| 252 | add |
---|
| 253 | blame praise annotate ann |
---|
| 254 | cat |
---|
| 255 | checkout co |
---|
| 256 | cleanup |
---|
| 257 | commit ci |
---|
| 258 | copy cp |
---|
| 259 | delete del remove rm |
---|
| 260 | diff di |
---|
| 261 | export |
---|
| 262 | import |
---|
| 263 | info |
---|
| 264 | list ls |
---|
| 265 | lock |
---|
| 266 | log |
---|
| 267 | merge |
---|
| 268 | mkdir |
---|
| 269 | move mv rename ren |
---|
| 270 | propdel pdel pd |
---|
| 271 | propedit pedit pe |
---|
| 272 | propget pget pg |
---|
| 273 | proplist plist pl |
---|
| 274 | propset pset ps |
---|
| 275 | resolved |
---|
| 276 | revert |
---|
| 277 | status stat st |
---|
| 278 | switch sw |
---|
| 279 | unlock |
---|
| 280 | update up |
---|
| 281 | }], |
---|
| 282 | invoker_class => 'Fcm::CLI::Invoker::CM', |
---|
| 283 | is_vc => 1, |
---|
| 284 | }), |
---|
| 285 | |
---|
| 286 | CONFLICTS => Fcm::CLI::Subcommand->new({ |
---|
| 287 | names => ['conflicts', 'cf'], |
---|
| 288 | synopsis => 'resolves conflicts in your working copy', |
---|
| 289 | usage => '[PATH]', |
---|
| 290 | invoker_class => 'Fcm::CLI::Invoker::CM', |
---|
| 291 | is_vc => 1, |
---|
| 292 | }), |
---|
| 293 | |
---|
| 294 | EXTRACT => Fcm::CLI::Subcommand->new({ |
---|
| 295 | names => ['extract', 'ext'], |
---|
| 296 | synopsis => 'invokes the extract system', |
---|
| 297 | usage => '[OPTIONS...] [CFGFILE]', |
---|
| 298 | description => $DESCRIPTION_OF{EXTRACT}, |
---|
| 299 | invoker_class => 'Fcm::CLI::Invoker::ConfigSystem', |
---|
| 300 | invoker_config => { |
---|
| 301 | impl_class => 'Fcm::Extract', |
---|
| 302 | cli2invoke_key_map => { |
---|
| 303 | 'clean' => 'CLEAN', |
---|
| 304 | 'full' => 'FULL', |
---|
| 305 | 'ignore-lock' => 'IGNORE_LOCK', |
---|
| 306 | }, |
---|
| 307 | }, |
---|
| 308 | options => [ |
---|
| 309 | $OPTION_OF{CLEAN}, |
---|
| 310 | $OPTION_OF{FULL}, |
---|
| 311 | $OPTION_OF{HELP}, |
---|
| 312 | $OPTION_OF{IGNORE_LOCK}, |
---|
| 313 | $OPTION_OF{VERBOSITY}, |
---|
| 314 | ], |
---|
| 315 | }), |
---|
| 316 | |
---|
| 317 | EXTRACT_CONFIG_COMPARATOR => Fcm::CLI::Subcommand->new({ |
---|
| 318 | names => ['cmp-ext-cfg'], |
---|
| 319 | synopsis => 'invokes the extract configuration files comparator', |
---|
| 320 | usage => '[OPTIONS...] CFGFILE1 CFGFILE2', |
---|
| 321 | description => $DESCRIPTION_OF{EXTRACT_CONFIG_COMPARATOR}, |
---|
| 322 | invoker_class => 'Fcm::CLI::Invoker::ExtractConfigComparator', |
---|
| 323 | options => [ |
---|
| 324 | $OPTION_OF{HELP}, |
---|
| 325 | $OPTION_OF{VERBOSITY}, |
---|
| 326 | $OPTION_OF{WIKI}, |
---|
| 327 | ], |
---|
| 328 | }), |
---|
| 329 | |
---|
| 330 | GUI => Fcm::CLI::Subcommand->new({ |
---|
| 331 | names => ['gui'], |
---|
| 332 | synopsis => 'invokes the GUI wrapper for code management commands', |
---|
| 333 | usage => '[PATH]', |
---|
| 334 | description => $DESCRIPTION_OF{GUI}, |
---|
| 335 | invoker_class => 'Fcm::CLI::Invoker::GUI', |
---|
| 336 | }), |
---|
| 337 | |
---|
| 338 | HELP => Fcm::CLI::Subcommand->new({ |
---|
| 339 | names => ['help', q{?}, q{}], |
---|
| 340 | synopsis => 'displays the usage of this program or its subcommands', |
---|
| 341 | usage => '[SUBCOMMAND]', |
---|
| 342 | description => q{}, |
---|
| 343 | invoker_class => 'Fcm::CLI::Invoker::Help', |
---|
| 344 | options => [$OPTION_OF{HELP}], |
---|
| 345 | }), |
---|
| 346 | |
---|
| 347 | KEYWORD => Fcm::CLI::Subcommand->new({ |
---|
| 348 | names => ['keyword-print', 'kp'], |
---|
| 349 | synopsis => 'prints registered location and/or revision keywords', |
---|
| 350 | usage => '[TARGET]', |
---|
| 351 | description => $DESCRIPTION_OF{KEYWORD}, |
---|
| 352 | invoker_class => 'Fcm::CLI::Invoker::KeywordPrinter', |
---|
| 353 | options => [$OPTION_OF{HELP}], |
---|
| 354 | }), |
---|
| 355 | |
---|
| 356 | MKPATCH => Fcm::CLI::Subcommand->new({ |
---|
| 357 | names => ['mkpatch'], |
---|
| 358 | synopsis => 'creates patches from specified revisions of a URL', |
---|
| 359 | usage => '[OPTIONS] URL [OUTDIR]', |
---|
| 360 | invoker_class => 'Fcm::CLI::Invoker::CM', |
---|
| 361 | is_vc => 1, |
---|
| 362 | }), |
---|
| 363 | ); |
---|
| 364 | |
---|
| 365 | our @CORE_SUBCOMMANDS = ( |
---|
| 366 | $SUBCOMMAND_OF{HELP}, |
---|
| 367 | $SUBCOMMAND_OF{BUILD}, |
---|
| 368 | $SUBCOMMAND_OF{CFG_PRINTER}, |
---|
| 369 | ); |
---|
| 370 | |
---|
| 371 | our @VC_SUBCOMMANDS = ( |
---|
| 372 | $SUBCOMMAND_OF{BRANCH}, |
---|
| 373 | $SUBCOMMAND_OF{BROWSER}, |
---|
| 374 | $SUBCOMMAND_OF{CONFLICTS}, |
---|
| 375 | $SUBCOMMAND_OF{EXTRACT}, |
---|
| 376 | $SUBCOMMAND_OF{EXTRACT_CONFIG_COMPARATOR}, |
---|
| 377 | $SUBCOMMAND_OF{GUI}, |
---|
| 378 | $SUBCOMMAND_OF{KEYWORD}, |
---|
| 379 | $SUBCOMMAND_OF{MKPATCH}, |
---|
| 380 | $SUBCOMMAND_OF{CM}, |
---|
| 381 | ); |
---|
| 382 | |
---|
| 383 | 1; |
---|
| 384 | __END__ |
---|
| 385 | |
---|
| 386 | =head1 NAME |
---|
| 387 | |
---|
| 388 | Fcm::CLI::Config::Default |
---|
| 389 | |
---|
| 390 | =head1 SYNOPSIS |
---|
| 391 | |
---|
| 392 | use Fcm::CLI::Config::Default; |
---|
| 393 | @core_subcommands = @Fcm::CLI::Config::Default::CORE_SUBCOMMANDS; |
---|
| 394 | @vc_subcommands = @Fcm::CLI::Config::Default::VC_SUBCOMMANDS; |
---|
| 395 | |
---|
| 396 | =head1 DESCRIPTION |
---|
| 397 | |
---|
| 398 | This module stores the default configuration of the FCM command line interface. |
---|
| 399 | It should only be used by L<Fcm::CLI::Config|Fcm::CLI::Config>. |
---|
| 400 | |
---|
| 401 | =head1 SEE ALSO |
---|
| 402 | |
---|
| 403 | L<Fcm::CLI::Config|Fcm::CLI::Config>, |
---|
| 404 | L<Fcm::CLI::Invoker|Fcm::CLI::Invoker>, |
---|
| 405 | L<Fcm::CLI::Subcommand|Fcm::CLI::Subcommand>, |
---|
| 406 | L<Fcm::CLI::Option|Fcm::CLI::Option> |
---|
| 407 | |
---|
| 408 | =head1 COPYRIGHT |
---|
| 409 | |
---|
| 410 | E<169> Crown copyright Met Office. All rights reserved. |
---|
| 411 | |
---|
| 412 | =cut |
---|