Last modified: December 2023

URL: https://cxc.cfa.harvard.edu/ciao/ahelp/pquery.html
AHELP for CIAO 4.16

pquery

Context: Tools::Parameter

Synopsis

Query whether a parameter exists and, if so, get and return its value.

Syntax

pquery toolname parameter
pquery toolname parameter [ [ para1=value ... ] | value1 ... ]

Description

`pquery' is useful in scripts to get parameter values. It will prompt the user for parameter values for queried parameters (if not specified as optional arguments to the command line) and will simply return the values of hidden parameters.


Examples

Example 1

pquery dmcopy infile

Since infile in dmcopy.par is a queried parameter, pquery would prompt the user for the value and then echo that back to STDOUT which could be grabbed by a script.

Example 2

pquery dmcopy infile infile='my_file.fits'

Now, since the parameter value has been specified, it will just return the parameter value (and set it in the parameter file).

Example 3

echo infile outfile clobber | pquery dmcopy - clob+

Will get the values for all three parameters: infile, outfile, and clobber. Since clobber is specified on the command line it will get the value (yes) from there. The other two parameter are typically 'queried'/automatic parameters and would be prompted for.


Parameters

name type ftype reqd
parameter_file string input yes
parameter string input yes

Detailed Parameter Descriptions

Parameter=parameter_file (string required filetype=input)

parameter file name

Name (plus optional path) of the parameter file to use

Parameter=parameter (string required filetype=input)

Name of parameter to query

The name of the parameter to query. Optionally can use the various parameter attributes listed below to return those values.

Parameter Attributes
p_mode Whether the parameter is prompted for or not
p_value The value of the parameter. If the parameter is a redirected, this returns the redirection string rather than what the redirection evaluates too.
p_min Minimum value allowed or a "|" separated list of values.
p_max Maximum value allowed
p_prompt The parameter prompt
p_type The data-type, or class, of the parameter. The allowed values are: 's' (string), 'f' (file), 'r' (real, floating-point value), 'i' (integer valuer), 'b' (boolean yes|no value).

If the parameter value is "-", a list of parameters is read from stdin.


Bugs

There are no known bugs for this tool.

See Also

concept
parameter
tools::header
dmhistory, dmkeypar, dmmakepar, dmreadpar
tools::parameter
paccess, pdump, pget, pline, plist, pset, punlearn