Skip to content

Commit 7337592

Browse files
committed
First pass at basic cli docs
This is not at all hand-crafted, and therefore a bit confusing, but at least it's something. (Partially) fixes #160
1 parent a5dd0af commit 7337592

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

docs/cli.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.. currentmodule:: tskit
2+
.. _sec_cli:
3+
4+
======================
5+
Command line interface
6+
======================
7+
8+
.. argparse::
9+
:module: tskit.cli
10+
:func: get_tskit_parser
11+
:prog: python3 -m tskit

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def handle_item(fieldarg, content):
119119
'sphinx.ext.intersphinx',
120120
'sphinx.ext.todo',
121121
'breathe',
122+
'sphinxarg.ext',
122123
'sphinx_issues',
123124
]
124125

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Welcome to tskit's documentation!
1515
python-api
1616
stats
1717
c-api
18+
cli
1819
data-model
1920
provenance
2021
development

python/tests/test_cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def test_provenances_long_args(self):
234234
self.assertEqual(args.tree_sequence, tree_sequence)
235235
self.assertEqual(args.human, True)
236236

237+
@unittest.skip("fasta output temporarily disabled")
237238
def test_fasta_default_values(self):
238239
parser = cli.get_tskit_parser()
239240
cmd = "fasta"
@@ -242,6 +243,7 @@ def test_fasta_default_values(self):
242243
self.assertEqual(args.tree_sequence, tree_sequence)
243244
self.assertEqual(args.wrap, 60)
244245

246+
@unittest.skip("fasta output temporarily disabled")
245247
def test_fasta_short_args(self):
246248
parser = cli.get_tskit_parser()
247249
cmd = "fasta"
@@ -251,6 +253,7 @@ def test_fasta_short_args(self):
251253
self.assertEqual(args.tree_sequence, tree_sequence)
252254
self.assertEqual(args.wrap, 100)
253255

256+
@unittest.skip("fasta output temporarily disabled")
254257
def test_fasta_long_args(self):
255258
parser = cli.get_tskit_parser()
256259
cmd = "fasta"
@@ -471,6 +474,7 @@ def verify_fasta(self, output_fasta):
471474
fasta = f.read()
472475
self.assertEqual(output_fasta, fasta)
473476

477+
@unittest.skip("fasta output temporarily disabled")
474478
def test_fasta(self):
475479
cmd = "fasta"
476480
stdout, stderr = capture_output(cli.tskit_main, [cmd, self._tree_sequence_file])

python/tskit/cli.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def add_precision_argument(parser):
152152

153153
def get_tskit_parser():
154154
top_parser = argparse.ArgumentParser(
155+
prog="python3 -m tskit",
155156
description="Command line interface for tskit.")
156157
top_parser.add_argument(
157158
"-V", "--version", action='version',
@@ -186,18 +187,15 @@ def get_tskit_parser():
186187
"--remove-duplicate-positions", "-d", action="store_true", default=False,
187188
help="Remove any duplicated mutation positions in the source file. ")
188189
parser.set_defaults(runner=run_upgrade)
189-
190-
parser = subparsers.add_parser(
191-
"fasta",
192-
# help="Convert the tree sequence haplotypes to fasta format")
193-
# suppress fasta visibility pending https://github.com/tskit-dev/tskit/issues/353
194-
help=argparse.SUPPRESS)
195-
add_tree_sequence_argument(parser)
196-
parser.add_argument(
197-
"--wrap", "-w", type=int, default=60,
198-
help=("line-wrapping width for printed sequences"))
199-
parser.set_defaults(runner=run_fasta)
200-
190+
# suppress fasta visibility pending https://github.com/tskit-dev/tskit/issues/353
191+
# parser = subparsers.add_parser(
192+
# "fasta",
193+
# help="Convert the tree sequence haplotypes to fasta format")
194+
# add_tree_sequence_argument(parser)
195+
# parser.add_argument(
196+
# "--wrap", "-w", type=int, default=60,
197+
# help=("line-wrapping width for printed sequences"))
198+
# parser.set_defaults(runner=run_fasta)
201199
parser = subparsers.add_parser(
202200
"vcf",
203201
help="Convert the tree sequence genotypes to VCF format.")

0 commit comments

Comments
 (0)