aboutsummaryrefslogtreecommitdiffstats
path: root/README.hacking
diff options
context:
space:
mode:
authorJiří Pinkava <j-pi@seznam.cz>2016-06-26 13:04:36 +0200
committerJiří Pinkava <j-pi@seznam.cz>2016-09-20 10:39:31 +0200
commitf874d7767cc1d70eb13add441124c4da9d637b4d (patch)
treeb6527df7b3a81d519706cb55cd58ede03860f030 /README.hacking
parentMerge branch 'master' into next (diff)
downloadgnuradio-f874d7767cc1d70eb13add441124c4da9d637b4d.tar.xz
gnuradio-f874d7767cc1d70eb13add441124c4da9d637b4d.zip
tools, docs: replace OptionParser by ArgumentParser
Diffstat (limited to 'README.hacking')
-rw-r--r--README.hacking60
1 files changed, 30 insertions, 30 deletions
diff --git a/README.hacking b/README.hacking
index 2d0a1c395..0b5bf6d0c 100644
--- a/README.hacking
+++ b/README.hacking
@@ -120,8 +120,8 @@ http://gnuradio.org/redmine/projects/gnuradio/wiki/Coding_guide_impl#Unit-testin
When writing programs that are executable from the command line,
please follow these guidelines for command line argument names (short
and long) and types of the arguments. We list them below using the
-Python optparse syntax. In general, the default value should be coded
-into the help string using the "... [default=%default]" syntax.
+Python argparse syntax. In general, the default value should be coded
+into the help string using the "... [default=%(default)r]" syntax.
** Mandatory options by gr::block
@@ -132,7 +132,7 @@ option parsing will automatically be set up for you.
Any program using an audio source shall include:
- add_option("-I", "--audio-input", type="string", default="",
+ add_argument("-I", "--audio-input", default="",
help="pcm input device name. E.g., hw:0,0 or /dev/dsp")
The default must be "". This allows an audio module-dependent default
@@ -141,7 +141,7 @@ to be specified in the user preferences file.
*** Audio sink
- add_option("-O", "--audio-output", type="string", default="",
+ add_argument("-O", "--audio-output", default="",
help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
The default must be "". This allows an audio module-dependent default
@@ -162,69 +162,69 @@ following parameters, please use these options to specify them:
To specify a frequency (typically an RF center frequency) use:
- add_option("-f", "--freq", type="eng_float", default=<your-default-here>,
- help="set frequency to FREQ [default=%default]")
+ add_argument("-f", "--freq", type=eng_float, default=<your-default-here>,
+ help="set frequency to FREQ [default=%(default)r]")
To specify a decimation factor use:
- add_option("-d", "--decim", type="intx", default=<your-default-here>,
- help="set decimation rate to DECIM [default=%default]")
+ add_argument("-d", "--decim", type=intx, default=<your-default-here>,
+ help="set decimation rate to DECIM [default=%(default)r]")
To specify an interpolation factor use:
- add_option("-i", "--interp", type="intx", default=<your-default-here>,
- help="set interpolation rate to INTERP [default=%default]")
+ add_argument("-i", "--interp", type=intx, default=<your-default-here>,
+ help="set interpolation rate to INTERP [default=%(default)r]")
To specify a gain setting use:
- add_option("-g", "--gain", type="eng_float", default=<your-default-here>,
- help="set gain in dB [default=%default]")
+ add_argument("-g", "--gain", type=eng_float, default=<your-default-here>,
+ help="set gain in dB [default=%(default)r]")
If your application specifies both a tx and an rx gain, use:
- add_option("", "--rx-gain", type="eng_float", default=<your-default-here>,
- help="set receive gain in dB [default=%default]")
+ add_argument("--rx-gain", type=eng_float, default=<your-default-here>,
+ help="set receive gain in dB [default=%(default)r]")
- add_option("", "--tx-gain", type="eng_float", default=<your-default-here>,
- help="set transmit gain in dB [default=%default]")
+ add_argument("--tx-gain", type=eng_float, default=<your-default-here>,
+ help="set transmit gain in dB [default=%(default)r]")
To specify the number of channels of something use:
- add_option("-n", "--nchannels", type="intx", default=1,
- help="specify number of channels [default=%default]")
+ add_argument("-n", "--nchannels", type=intx, default=1,
+ help="specify number of channels [default=%(default)r]")
To specify an output filename use:
- add_option("-o", "--output-filename", type="string", default=<your-default-here>,
- help="specify output-filename [default=%default]")
+ add_argument("-o", "--output-filename", default=<your-default-here>,
+ help="specify output-filename [default=%(default)r]")
To specify a rate use:
- add_option("-r", "--bit-rate", type="eng_float", default=<your-default-here>,
- help="specify bit-rate [default=%default]")
+ add_argument("-r", "--bit-rate", type=eng_float, default=<your-default-here>,
+ help="specify bit-rate [default=%(default)r]")
or
- add_option("-r", "--sample-rate", type="eng_float", default=<your-default-here>,
- help="specify sample-rate [default=%default]")
+ add_argument("-r", "--sample-rate", type=eng_float, default=<your-default-here>,
+ help="specify sample-rate [default=%(default)r]")
If your application has a verbose option, use:
- add_option('-v', '--verbose', action="store_true", default=False,
- help="verbose output")
+ add_argument('-v', '--verbose', action="store_true",
+ help="verbose output")
If your application allows the user to specify the "fast USB" options, use:
- add_option("", "--fusb-block-size", type="intx", default=0,
- help="specify fast USB block size [default=%default]")
+ add_argument("--fusb-block-size", type=intx, default=0,
+ help="specify fast USB block size [default=%(default)r]")
- add_option("", "--fusb-nblocks", type="intx", default=0,
- help="specify number of fast USB blocks [default=%default]")
+ add_argument("--fusb-nblocks", type=intx, default=0,
+ help="specify number of fast USB blocks [default=%(default)r]")