diff options
| author | fukachan <fukachan> | 2004-03-23 04:20:45 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-03-23 04:20:45 +0000 |
| commit | 3f632b97f6213e8d651ebe52ddba0b99062f67bf (patch) | |
| tree | 119de4e5a4d20edbc60a7c4f2bf0b2e3faeca5fa | |
| parent | 5936b223da8db7680e62e68752d04c54d6772245 (diff) | |
| download | fml8-3f632b97f6213e8d651ebe52ddba0b99062f67bf.tar.gz fml8-3f632b97f6213e8d651ebe52ddba0b99062f67bf.tar.bz2 fml8-3f632b97f6213e8d651ebe52ddba0b99062f67bf.zip | |
try to allow -O key=value command line options. Internally each
function uses cui_command_specific_options() to get the command
specific options.
| -rw-r--r-- | fml/etc/command_line_options | 6 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/spool.pm | 24 | ||||
| -rw-r--r-- | fml/lib/FML/Process/Utils.pm | 15 |
3 files changed, 30 insertions, 15 deletions
diff --git a/fml/etc/command_line_options b/fml/etc/command_line_options index 30d49081..c222de53 100644 --- a/fml/etc/command_line_options +++ b/fml/etc/command_line_options @@ -1,5 +1,5 @@ # -# $FML: command_line_options,v 1.12 2004/03/14 06:54:43 fukachan Exp $ +# $FML: command_line_options,v 1.13 2004/03/14 06:55:14 fukachan Exp $ # # map between programs and options # @@ -17,7 +17,7 @@ mead debug! help! -c=s -o=s% faker debug! help! -c=s -o=s% # bin/ -fml debug! help! force! log-dup! log-computer-output! quiet! q! allow-send-message! -c=s -o=s% mode=s +fml debug! help! force! log-dup! log-computer-output! quiet! q! allow-send-message! -c=s -o=s% -O=s% mode=s fmladdr debug! help! n! -c=s -o=s% fmlalias debug! help! n! -c=s -o=s% fmlconf debug! help! n! -c=s -o=s% @@ -26,7 +26,7 @@ fmlerror debug! help! -o=s% fmlhtmlify debug! help! -I=s -o=s% fmlspool debug! help! -I=s convert! style=s srcdir=s -o=s% fmlthread debug! help! article_id_max=i spool_dir=s base_url=s msg_base_url=s reverse! -f=s -c=s -o=s% -makefml debug! help! force! log-dup! log-computer-output! quiet! q! allow-send-message! -c=s -o=s% mode=s +makefml debug! help! force! log-dup! log-computer-output! quiet! q! allow-send-message! -c=s -o=s% -O=%s mode=s # cgi-bin/ config.cgi diff --git a/fml/lib/FML/Command/Admin/spool.pm b/fml/lib/FML/Command/Admin/spool.pm index 7cb640d3..4d2cf2f7 100644 --- a/fml/lib/FML/Command/Admin/spool.pm +++ b/fml/lib/FML/Command/Admin/spool.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: spool.pm,v 1.3 2003/03/18 10:42:43 fukachan Exp $ +# $FML: spool.pm,v 1.4 2003/08/23 04:35:32 fukachan Exp $ # package FML::Command::Admin::spool; @@ -67,23 +67,25 @@ sub process { my ($self, $curproc, $command_args) = @_; my $config = $curproc->config(); + my $c_opts = $curproc->cui_command_specific_options() || {}; my $options = $command_args->{ options }; my $fp = $options->[ 0 ] || 'status'; - # XXX-TODO: makefml $ml spool ... what arguments is appropriate ? - # use $dst_dir as $src_dir if --srcdir=DIR not specified. - # you can specify the spool type by --style=subdir ? - # but only "subdir" is supported now :) ? - # prepare arguments on $*_dir directory info. - my $dst_dir = $config->{ spool_dir }; - my $src_dir = $dst_dir; + my $dst_dir = $c_opts->{ dst_dir } || $config->{ spool_dir }; + my $src_dir = $c_opts->{ src_dir } || $config->{ spool_dir }; + + # sanity + croak("\$src_dir unspecified") unless $src_dir; + croak("no such directory: $src_dir") unless -d $src_dir; + + # prepare command specific parameters $command_args->{ _src_dir } = $src_dir; $command_args->{ _dst_dir } = $dst_dir; + $command_args->{ _output_channel } = \*STDOUT; # suppose only makefml. - # output channel (we suppose only makefml here). - $command_args->{ _output_channel } = \*STDOUT; - + # here we go. + print STDERR "converting $src_dir -> $dst_dir\n"; use FML::Article::Spool; my $spool = new FML::Article::Spool $curproc; if ($spool->can($fp)) { diff --git a/fml/lib/FML/Process/Utils.pm b/fml/lib/FML/Process/Utils.pm index 4300d987..b031e4d3 100644 --- a/fml/lib/FML/Process/Utils.pm +++ b/fml/lib/FML/Process/Utils.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Utils.pm,v 1.107 2004/02/27 22:17:40 fukachan Exp $ +# $FML: Utils.pm,v 1.108 2004/03/13 10:27:43 fukachan Exp $ # package FML::Process::Utils; @@ -801,6 +801,19 @@ sub command_line_options } +# Descriptions: return comman specific options (-O key=value) as HASH_REF. +# Arguments: OBJ($curproc) +# Side Effects: none +# Return Value: HASH_REF +sub cui_command_specific_options +{ + my ($curproc) = @_; + my $args = $curproc->{ __parent_args }; + + return( $args->{ options }->{ O } || {} ); +} + + =head2 set_config_files_list($cf_file_path_array) set configuration file (.cf) to internal list. |
