Skip to content

Commit

Permalink
[MRG] add -d/--debug to sourmash sig describe; upgrade output err…
Browse files Browse the repository at this point in the history
…ors. (#1782)

* add -d/--debug to various commands

* upgrade output error messages

* add message about using --debug
  • Loading branch information
ctb authored Mar 25, 2022
1 parent 515a06d commit f54f60f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/sourmash/cli/sig/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def subparser(subparsers):
'-q', '--quiet', action='store_true',
help='suppress non-error output'
)
subparser.add_argument(
'-d', '--debug', action='store_true',
help='provide debugging output'
)
subparser.add_argument(
'--csv', metavar='FILE',
help='output information to a CSV file'
Expand Down
9 changes: 6 additions & 3 deletions src/sourmash/sig/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def describe(args):
"""
provide basic info on signatures
"""
set_quiet(args.quiet)
set_quiet(args.quiet, args.debug)
moltype = sourmash_args.calculate_moltype(args)
picklist = sourmash_args.load_picklist(args)
pattern_search = sourmash_args.load_include_exclude_db_patterns(args)
Expand Down Expand Up @@ -287,7 +287,8 @@ def manifest(args):
loader = sourmash_args.load_file_as_index(args.location,
yield_all_files=args.force)
except ValueError as exc:
error(f"Cannot open '{args.location}'.")
error(f"Cannot open '{args.location}' as a sourmash signature collection.")
error("Use -d/--debug for details.")
sys.exit(-1)

rebuild = True
Expand Down Expand Up @@ -1193,6 +1194,7 @@ def kmers(args):
_SketchInfo = namedtuple('_SketchInfo', 'ksize, moltype, scaled, num, abund')


# NOTE: also aliased as 'summarize'
def fileinfo(args):
"""
provide summary information on the given path (collection, index, etc.)
Expand All @@ -1209,7 +1211,8 @@ def fileinfo(args):
idx = sourmash_args.load_file_as_index(args.path,
yield_all_files=args.force)
except ValueError:
error(f"Cannot open '{args.path}'.")
error(f"Cannot open '{args.path}' as a sourmash signature collection.")
error("Use -d/--debug for details.")
sys.exit(-1)

print_bool = lambda x: "yes" if x else "no"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -3572,7 +3572,7 @@ def test_sig_manifest_does_not_exist(runtmp):
runtmp.run_sourmash('sig', 'manifest', 'does-not-exist',
'-o', 'out.csv')

assert "Cannot open 'does-not-exist'." in runtmp.last_result.err
assert "Cannot open 'does-not-exist' as a sourmash signature collection." in runtmp.last_result.err


def test_sig_manifest_7_allzip_1(runtmp):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_signature_fileinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,4 @@ def test_sig_fileinfo_does_not_exist(runtmp):
with pytest.raises(SourmashCommandFailed):
runtmp.run_sourmash('sig', 'fileinfo', 'does-not-exist')

assert "Cannot open 'does-not-exist'." in runtmp.last_result.err
assert "Cannot open 'does-not-exist' as a sourmash signature collection" in runtmp.last_result.err

0 comments on commit f54f60f

Please sign in to comment.