Skip to content

Commit 61c9314

Browse files
authored
Merge pull request #181 from UW-Hydro/develop
Add --version option
2 parents 1f23666 + 1bda902 commit 61c9314

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/index.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,21 @@ in the configuration files see the `configuration <configuration.rst>`_ page.
105105

106106
Once installed, MetSim can be used from the command line via:
107107

108-
``ms /path/to/configuration [-v] [-n #]``
108+
.. code-block:: bash
109+
110+
usage: ms [-h] [-n NUM_WORKERS] [-s SCHEDULER] [-v] [--version] config
111+
112+
positional arguments:
113+
config Input configuration file
114+
115+
optional arguments:
116+
-h, --help show this help message and exit
117+
-n NUM_WORKERS, --num_workers NUM_WORKERS
118+
Parallel mode: number of processes to use
119+
-s SCHEDULER, --scheduler SCHEDULER
120+
Dask scheduler to use
121+
-v, --verbose Increase the verbosity of MetSim
122+
--version Name and version number
109123
110124
Bracketed flags are optional; ``-v`` activates verbose mode to print messages
111125
about the status of a run, and ``-n`` activates parallelism. The number given

docs/whats-new.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
What's New
44
==========
55

6+
.. _whats-new.2.1.1.develop:
7+
8+
v.2.1.1.develop
9+
-------
10+
Enhancements
11+
~~~~~~~~~~~~
12+
- Allow for ``--version`` flag on command-line.
13+
614
.. _whats-new.2.0.1.develop:
715

816
v.2.0.1.develop

metsim/cli/ms.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def _is_valid_file(parser, arg):
3838

3939
def parse(args):
4040
"""Parse the command line arguments"""
41+
from metsim import __name__, __version__
4142
parser = argparse.ArgumentParser()
4243
parser.add_argument('config', type=lambda x: _is_valid_file(parser, x),
4344
help='Input configuration file')
@@ -47,6 +48,9 @@ def parse(args):
4748
help='Dask scheduler to use')
4849
parser.add_argument('-v', '--verbose', action='store_true',
4950
help='Increase the verbosity of MetSim')
51+
parser.add_argument('--version', action='version',
52+
version='{} {}'.format(__name__, __version__),
53+
help='Name and version number')
5054
return parser.parse_args()
5155

5256

0 commit comments

Comments
 (0)