We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7c34113 commit 30984fbCopy full SHA for 30984fb
stagpy/args.py
@@ -6,6 +6,7 @@
6
from loam.tools import set_conf_str, create_complete_files
7
from loam.cli import Subcmd, CLIManager
8
9
+from . import __doc__ as doc_module
10
from . import conf, PARSING_OUT, load_mplstyle
11
from . import commands, field, rprof, time_series, refstate, plates
12
from .misc import baredoc
@@ -18,9 +19,14 @@ def _sub(cmd, *sections):
18
19
return Subcmd(baredoc(cmd), *sections, func=cmd_func)
20
21
22
+def _bare_cmd():
23
+ """Print help message when no arguments are given."""
24
+ print(doc_module)
25
+ print('Run `stagpy -h` for usage')
26
+
27
28
SUB_CMDS = OrderedDict((
- ('common_', Subcmd('read and process StagYY binary data', 'common',
- func=lambda: print('stagpy -h for usage'))),
29
+ ('common_', Subcmd(doc_module, 'common', func=_bare_cmd)),
30
('field', _sub(field, 'core', 'plot', 'scaling')),
31
('rprof', _sub(rprof, 'core', 'plot', 'scaling')),
32
('time', _sub(time_series, 'core', 'plot', 'scaling')),
tests/test_args.py
@@ -6,16 +6,19 @@
def test_no_args(capsys):
stagpy.args.parse_args([])()
output = capsys.readouterr()
- expected = 'stagpy -h for usage\n'
- assert output.out == expected
+ expected = re.compile(
+ r'StagPy is a tool to.*'
+ r'Run `stagpy -h` for usage\n$',
+ flags=re.DOTALL)
13
+ assert expected.fullmatch(output.out)
14
15
16
def test_help(capsys):
17
with pytest.raises(SystemExit):
stagpy.args.parse_args(['-h'])
expected = re.compile(
- r'^usage:.*\nread and process StagYY binary data.*'
+ r'^usage:.*\nStagPy is a tool to.*'
r'\npositional arguments.*\noptional arguments.*$',
flags=re.DOTALL)
assert expected.fullmatch(output.out)
0 commit comments