diff options
-rw-r--r-- | bin/mutual_friends.py | 9 | ||||
-rw-r--r-- | docs/mutual_friends.md | 5 |
2 files changed, 7 insertions, 7 deletions
diff --git a/bin/mutual_friends.py b/bin/mutual_friends.py index 56b19f6..9a1dfc4 100644 --- a/bin/mutual_friends.py +++ b/bin/mutual_friends.py @@ -73,7 +73,7 @@ def _parse_output_format(s): try: return OutputFormat(s) except ValueError: - raise argparse.ArgumentTypeError('invalid output format: ' + str(s)) + raise argparse.ArgumentTypeError('invalid output format: ' + s) def _parse_args(args=sys.argv): parser = argparse.ArgumentParser( @@ -81,11 +81,12 @@ def _parse_args(args=sys.argv): parser.add_argument('uids', metavar='UID', nargs='+', help='user IDs or "screen names"') - parser.add_argument('--output-format', dest='fmt', - type=_parse_output_format, default=OutputFormat.CSV, + parser.add_argument('-f', '--format', dest='fmt', + type=_parse_output_format, + default=OutputFormat.CSV, choices=OutputFormat, help='specify output format') - parser.add_argument('-o', '--output', dest='fd', metavar='PATH', + parser.add_argument('-o', '--output', metavar='PATH', dest='fd', type=argparse.FileType('w', encoding='utf-8'), default=sys.stdout, help='set output file path (standard output by default)') diff --git a/docs/mutual_friends.md b/docs/mutual_friends.md index 10c1218..39ee76f 100644 --- a/docs/mutual_friends.md +++ b/docs/mutual_friends.md @@ -9,8 +9,7 @@ Usage Run from the top-level directory using `python -m`: > python -m bin.mutual_friends -h - usage: mutual_friends.py [-h] [--output-format {csv,json}] [-o PATH] - UID [UID ...] + usage: mutual_friends.py [-h] [-f {csv,json}] [-o PATH] UID [UID ...] ... For example (using made up user IDs/"screen names"), @@ -25,7 +24,7 @@ Smith" and "Jane Smith", whose user IDs are 89497105 and 3698577 respectively. The output format is CSV (comma-separated values) by default. You can also get a JSON document: - > python -m bin.mutual_friends --output-format json john.doe jane.doe + > python -m bin.mutual_friends --format json john.doe jane.doe [ { "uid": 89497105, |