-
Notifications
You must be signed in to change notification settings - Fork 78
/
__init__.py
36 lines (32 loc) · 1.21 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""Define the command line interface for sourmash sketch
The top level CLI is defined in ../__init__.py. This module defines the CLI for
`sourmash sketch` operations.
"""
from . import dna
from . import dna as rna
from . import protein
from . import protein as aa
from . import protein as prot
from . import translate
from . import fromfile
from ..utils import command_list
from argparse import SUPPRESS, RawDescriptionHelpFormatter
import os
import sys
def subparser(subparsers):
subparser = subparsers.add_parser('sketch', formatter_class=RawDescriptionHelpFormatter, usage=SUPPRESS)
desc = 'Operations\n'
clidir = os.path.dirname(__file__)
ops = command_list(clidir)
for subcmd in ops:
docstring = getattr(sys.modules[__name__], subcmd).__doc__
helpstring = 'sourmash sketch {op:s} --help'.format(op=subcmd)
desc += ' {hs:33s} {ds:s}\n'.format(hs=helpstring, ds=docstring)
s = subparser.add_subparsers(
title='Create signatures', dest='subcmd', metavar='subcmd', help=SUPPRESS,
description=desc
)
for subcmd in ops:
getattr(sys.modules[__name__], subcmd).subparser(s)
subparser._action_groups.reverse()
subparser._optionals.title = 'Options'