source: XMLIO_V2/tools/FCM/lib/Fcm/CLI/Config/Default.pm @ 81

Last change on this file since 81 was 81, checked in by ymipsl, 14 years ago

ajout FCM 1.5

File size: 14.0 KB
Line 
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# ------------------------------------------------------------------------------
6use strict;
7use warnings;
8
9package Fcm::CLI::Config::Default;
10
11use Fcm::CLI::Option;
12use Fcm::CLI::Subcommand;
13
14my %DESCRIPTION_OF = (
15    # --------------------------------------------------------------------------
16    BROWSER => <<'END_DESCRIPTION',
17If TARGET is specified, it must be a FCM URL keyword, a Subversion URL or the
18path to a local working copy. If not specified, the current working directory
19is assumed to be a working copy. If the --browser option is specified, the
20specified web browser command is used to launch the repository browser.
21Otherwise, it attempts to use the default browser from the configuration
22setting.
23END_DESCRIPTION
24    # --------------------------------------------------------------------------
25    BUILD => <<'END_DESCRIPTION',
26The path to a CFGFILE may be provided. Otherwise, the build system searches the
27default locations for a bld cfg file.
28
29If no option is specified, the options "-s 5 -t all -j 1 -v 1" are assumed.
30
31If the option for full build is specified, the sub-directories created by
32previous builds will be removed, so that the current build can start cleanly.
33
34The -s option can be used to limit the actions performed by the build system up
35to 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
42If a colon separated list of targets is specified using the -t option, the
43default targets specified in the configuration file will not be used.
44
45If archive mode is switched on, build sub-directories that are only used in the
46build process will be archived to TAR files. The default is off.
47
48If specified, the verbose level must be an integer greater than 0. Verbose
49level 0 is the quiet mode. Increasing the verbose level will increase the
50amount of diagnostic output.
51
52When a build is invoked, it sets up a lock file in the build root directory.
53The lock is normally removed at the end of the build. While the lock file is in
54place, the build commands invoked in the same root directory will fail.  If
55you need to bypass this check for whatever reason, you can invoke the build
56system with the --ignore-lock option.
57END_DESCRIPTION
58    # --------------------------------------------------------------------------
59    CFG_PRINTER => <<'END_DESCRIPTION',
60If no option is specified, the output will be sent to standard output.
61END_DESCRIPTION
62    # --------------------------------------------------------------------------
63    EXTRACT => <<'END_DESCRIPTION',
64The path to a CFG file may be provided. Otherwise, the extract system searches
65the default locations for an ext cfg file.
66
67If no option is specified, the system will attempt an incremental extract where
68appropriate.
69
70If specified, the verbose level must be an integer greater than 0. Verbose
71level 0 is the quiet mode. Increasing the verbose level will increase the
72amount of diagnostic output.
73
74When an extract is invoked, it sets up a lock file in the extract destination
75root directory. The lock is normally removed at the end of the extract. While
76the lock file is in place, other extract commands invoked in the same
77destination root directory will fail. If you need to bypass this check for
78whatever reason, you can invoke the extract system with the --ignore-lock
79option.
80END_DESCRIPTION
81    # --------------------------------------------------------------------------
82    EXTRACT_CONFIG_COMPARATOR => <<'END_DESCRIPTION',
83Compares the extract configurations of two similar extract configuration files
84CFGFILE1 and CFGFILE2.
85
86In normal mode with verbosity level 2 or above, displays the change log of each
87revision.
88
89In wiki mode, print revision tables in wiki format. The argument to the --wiki
90option must be the Subversion URL or FCM URL keyword of a FCM project
91associated with the intended Trac system. The --verbose option has no effect
92in wiki mode.
93END_DESCRIPTION
94    # --------------------------------------------------------------------------
95    GUI => <<'END_DESCRIPTION',
96The optional argument PATH modifies the initial working directory of the GUI.
97END_DESCRIPTION
98    # --------------------------------------------------------------------------
99    KEYWORD => <<'END_DESCRIPTION',
100If no argument is specified, prints registered location keywords. Otherwise,
101prints the implied location keywords and revision keywords for the specified
102target.
103END_DESCRIPTION
104);
105
106my %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
187my %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
365our @CORE_SUBCOMMANDS = (
366    $SUBCOMMAND_OF{HELP},
367    $SUBCOMMAND_OF{BUILD},
368    $SUBCOMMAND_OF{CFG_PRINTER},
369);
370
371our @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
3831;
384__END__
385
386=head1 NAME
387
388Fcm::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
398This module stores the default configuration of the FCM command line interface.
399It should only be used by L<Fcm::CLI::Config|Fcm::CLI::Config>.
400
401=head1 SEE ALSO
402
403L<Fcm::CLI::Config|Fcm::CLI::Config>,
404L<Fcm::CLI::Invoker|Fcm::CLI::Invoker>,
405L<Fcm::CLI::Subcommand|Fcm::CLI::Subcommand>,
406L<Fcm::CLI::Option|Fcm::CLI::Option>
407
408=head1 COPYRIGHT
409
410E<169> Crown copyright Met Office. All rights reserved.
411
412=cut
Note: See TracBrowser for help on using the repository browser.