--cmds is preferred instead of --extracmds

This commit is contained in:
Dima Kogan 2021-03-11 16:21:57 -08:00
parent d68b331af6
commit 0006e29b52
3 changed files with 28 additions and 17 deletions

View File

@ -97,6 +97,7 @@ sub interpretCommandline
$options{x2y1} = []; $options{x2y1} = [];
$options{x2y2} = []; $options{x2y2} = [];
$options{extracmds} = []; $options{extracmds} = [];
$options{cmds} = [];
$options{set} = []; $options{set} = [];
$options{unset} = []; $options{unset} = [];
$options{equation} = []; $options{equation} = [];
@ -120,7 +121,9 @@ sub interpretCommandline
'ymin=f', 'ymax=f', 'y2min=f', 'y2max=f', 'ymin=f', 'ymax=f', 'y2min=f', 'y2max=f',
'zmin=f', 'zmax=f', 'zmin=f', 'zmax=f',
'x2=s@', 'y2=s@', 'x1y2=s@', 'x2y1=s@', 'x2y2=s@', 'x2=s@', 'y2=s@', 'x1y2=s@', 'x2y1=s@', 'x2y2=s@',
'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s', 'extracmds=s@', 'set=s@', 'unset=s@', 'style=s{2}', 'curvestyle=s{2}', 'curvestyleall=s', 'styleall=s', 'with=s',
'extracmds=s@', 'cmds=s@',
'set=s@', 'unset=s@',
'every=s{2}', 'everyall=s', 'every=s{2}', 'everyall=s',
'using=s{2}', 'usingall=s', 'using=s{2}', 'usingall=s',
'square!', 'square_xy!', 'square-xy!', 'squarexy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s', 'square!', 'square_xy!', 'square-xy!', 'squarexy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!', 'timefmt=s',
@ -160,6 +163,9 @@ sub interpretCommandline
# various square-xy synonyms # various square-xy synonyms
$options{'square_xy'} = 1 if $options{'square-xy'} || $options{'squarexy'}; $options{'square_xy'} = 1 if $options{'square-xy'} || $options{'squarexy'};
# --extracmds is a synonym for --cmds
push @{$options{extracmds}}, @{$options{cmds}};
$options{cmds} = [];
push @{$options{curvestyle}}, @{$options{style}}; push @{$options{curvestyle}}, @{$options{style}};
delete $options{style}; delete $options{style};
@ -1472,13 +1478,12 @@ points. New curves will be created as needed.
The most commonly used functionality of gnuplot is supported directly by the The most commonly used functionality of gnuplot is supported directly by the
script. Anything not directly supported can still be done with options such as script. Anything not directly supported can still be done with options such as
C<--set>, C<--extracmds> C<--style>, etc. Arbitrary gnuplot commands can be C<--set>, C<--cmds> C<--style>, etc. Arbitrary gnuplot commands can be passed in
passed in with C<--extracmds>. For example, to turn off the grid, you can pass with C<--cmds>. For example, to turn off the grid, you can pass in C<--cmds
in C<--extracmds 'unset grid'>. Commands C<--set> and C<--unset> exists to 'unset grid'>. Commands C<--set> and C<--unset> exists to provide nicer syntax,
provide nicer syntax, so this is equivalent to passing C<--unset grid>. As many so this is equivalent to passing C<--unset grid>. As many of these options as
of these options as needed can be passed in. To add arbitrary curve styles, use needed can be passed in. To add arbitrary curve styles, use C<--style curveID
C<--style curveID extrastyle>. Pass these more than once to affect more than one extrastyle>. Pass these more than once to affect more than one curve.
curve.
To apply an extra style to I<all> the curves that lack an explicit C<--style>, To apply an extra style to I<all> the curves that lack an explicit C<--style>,
pass in C<--styleall extrastyle>. In the most common case, the extra style is pass in C<--styleall extrastyle>. In the most common case, the extra style is
@ -1682,12 +1687,12 @@ C<using> expression to plot a time series I<and> its cumulative integral. The
C<using> expression can compute the integral, but you I<must> pass in the data C<using> expression can compute the integral, but you I<must> pass in the data
twice; once for each curve to plot: twice; once for each curve to plot:
seq 100 | \ seq 100 | \
awk '{print $1,$1}' | \ awk '{print $1,$1}' | \
feedgnuplot \ feedgnuplot \
--extracmds 'sum=0' \ --cmds 'sum=0' \
--extracmds 'accum(x) = (sum=sum+x)' \ --cmds 'accum(x) = (sum=sum+x)' \
--using 1 '1:(accum($2))' \ --using 1 '1:(accum($2))' \
--lines --y2 1 --lines --y2 1
=back =back
@ -2140,13 +2145,19 @@ applies to I<all> the curves.
=item =item
C<--extracmds xxx> C<--cmds xxx>
Additional commands to pass on to gnuplot verbatim. These could contain extra Additional commands to pass on to gnuplot verbatim. These could contain extra
global styles for instance. Can be passed multiple times. global styles for instance. Can be passed multiple times.
=item =item
C<--extracmds xxx>
Synonym for C<--cmds xxx>
=item
C<--set xxx> C<--set xxx>
Additional 'set' commands to pass on to gnuplot verbatim. C<--set 'a b c'> will Additional 'set' commands to pass on to gnuplot verbatim. C<--set 'a b c'> will

View File

@ -21,7 +21,7 @@ complete -W \
--rangesize \ --rangesize \
--tuplesizeall \ --tuplesizeall \
--tuplesize \ --tuplesize \
--extracmds \ --cmds \
--set \ --set \
--unset \ --unset \
--equation \ --equation \

View File

@ -35,7 +35,7 @@ _arguments -S
'(--with)--curvestyleall[Additional styles for ALL curves]:style' \ '(--with)--curvestyleall[Additional styles for ALL curves]:style' \
'(--with)--styleall[Additional styles for ALL curves]:style' \ '(--with)--styleall[Additional styles for ALL curves]:style' \
'(--curvestyleall)--with[Additional styles for ALL curves]:style' \ '(--curvestyleall)--with[Additional styles for ALL curves]:style' \
'*--extracmds[Additional gnuplot commands]:command' \ '*--cmds[Additional gnuplot commands]:command' \
'*--set[Additional 'set' gnuplot commands]:set-option' \ '*--set[Additional 'set' gnuplot commands]:set-option' \
'*--unset[Additional 'unset' gnuplot commands]:unset-option' \ '*--unset[Additional 'unset' gnuplot commands]:unset-option' \
'*--equation[Raw symbolic equation]:equation' \ '*--equation[Raw symbolic equation]:equation' \