Skip to content

Commit

Permalink
Add default values in command line help output
Browse files Browse the repository at this point in the history
  • Loading branch information
eht16 committed Jun 14, 2020
1 parent 7932674 commit d68c197
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 34 deletions.
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,25 @@ Command line options

optional arguments:
-h, --help show this help message and exit
-V, --version show version and exit
-d, --debug enable tracebacks
-v, --verbose Show own log messages
-V, --version show version and exit (default: False)
-d, --debug enable tracebacks (default: False)
-v, --verbose Show own log messages (default: False)
-c FILE, --config FILE
configuration file path
-f, --follow Constantly fetch new data from ElasticSearch
configuration file path (default: None)
-f, --follow Constantly fetch new data from ElasticSearch (default: False)
-l, --list-saved-searches
List all saved searches from Kibana
-H, --no-header Do not print header line before the output
--csv Use CSV (comma separated) output
-n NUM, --lines NUM Output the last NUM lines, instead of the last 10
List all saved searches from Kibana (default: False)
-H, --no-header Do not print header line before the output (default: False)
--csv Use CSV (comma separated) output (default: False)
-n NUM, --lines NUM Output the last NUM lines, instead of the last 10 (default: None)
-q QUERY, --query QUERY
Set/Overwrite the search query (use Lucene query
syntax)
Set/Overwrite the search query (use Lucene query syntax) (default: None)
-r RANGE, --range RANGE
Query events from the last RANGE
minutes(m)/hours(h)/days(d)
Query events from the last RANGE minutes(m)/hours(h)/days(d) (default: None)
-s NAME, --saved-search NAME
Saved search title as stored in Kibana
("-" to select from a list)
Saved search title as stored in Kibana ("-" to select from a list) (default: None)
--select-saved-search
Interactively select a saved search from a list
Interactively select a saved search from a list (default: False)


Contributing
Expand Down
29 changes: 13 additions & 16 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,25 @@ Command line options
optional arguments:
-h, --help show this help message and exit
-V, --version show version and exit
-d, --debug enable tracebacks
-v, --verbose Show own log messages
-V, --version show version and exit (default: False)
-d, --debug enable tracebacks (default: False)
-v, --verbose Show own log messages (default: False)
-c FILE, --config FILE
configuration file path
-f, --follow Constantly fetch new data from ElasticSearch
configuration file path (default: None)
-f, --follow Constantly fetch new data from ElasticSearch (default: False)
-l, --list-saved-searches
List all saved searches from Kibana
-H, --no-header Do not print header line before the output
--csv Use CSV (comma separated) output
-n NUM, --lines NUM Output the last NUM lines, instead of the last 10
List all saved searches from Kibana (default: False)
-H, --no-header Do not print header line before the output (default: False)
--csv Use CSV (comma separated) output (default: False)
-n NUM, --lines NUM Output the last NUM lines, instead of the last 10 (default: None)
-q QUERY, --query QUERY
Set/Overwrite the search query (use Lucene query
syntax)
Set/Overwrite the search query (use Lucene query syntax) (default: None)
-r RANGE, --range RANGE
Query events from the last RANGE
minutes(m)/hours(h)/days(d)
Query events from the last RANGE minutes(m)/hours(h)/days(d) (default: None)
-s NAME, --saved-search NAME
Saved search title as stored in Kibana
("-" to select from a list)
Saved search title as stored in Kibana ("-" to select from a list) (default: None)
--select-saved-search
Interactively select a saved search from a list
Interactively select a saved search from a list (default: False)
Examples
Expand Down
4 changes: 2 additions & 2 deletions lstail/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.

from argparse import ArgumentParser
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser


########################################################################
Expand All @@ -26,7 +26,7 @@ def parse(self):

# ----------------------------------------------------------------------
def _init_argument_parser(self):
self._argument_parser = ArgumentParser()
self._argument_parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
# mutually exclusive group for --lines and --range to support only one of them or none
# but not both at once
self._initial_query_exclusive_group = self._argument_parser.add_mutually_exclusive_group()
Expand Down

0 comments on commit d68c197

Please sign in to comment.