Skip to content

Commit

Permalink
Merge pull request #42 from rachmadaniHaryono/feature/add-program-ver…
Browse files Browse the repository at this point in the history
…sion

chg: dev: add program version.
  • Loading branch information
rachmadaniHaryono authored May 7, 2017
2 parents 9841839 + 9d4d027 commit 64a37f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions export_saved.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import praw


__version__ = '0.1.1'


# # Converter class from https://gist.github.com/raphaa/1327761
class Converter():
"""Converts a CSV instapaper export to a Chrome bookmark file."""
Expand Down Expand Up @@ -95,6 +98,7 @@ def get_args(argv):
action="store_true")
parser.add_argument("-all", "--all", help="get upvoted, saved, comments and submissions",
action="store_true")
parser.add_argument("-V", "--version", help="get program version.", action="store_true")

args = parser.parse_args(argv)
return args
Expand Down Expand Up @@ -302,6 +306,10 @@ def main():
# set logging config
if args.verbose:
logging.basicConfig(level=logging.DEBUG)
# print program version.
if args.version:
print(__version__)
return

reddit = login(args=args)
if args.upvoted:
Expand Down
4 changes: 3 additions & 1 deletion tests/test_export_saved.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
{
'all': False, 'upvoted': False, 'verbose': False,
'client_secret': None, 'password': None,
'username': None, 'client_id': None
'username': None, 'client_id': None,
'version': False
}
)]
)
Expand Down Expand Up @@ -173,6 +174,7 @@ def test_main(verbose, upvoted, all):
verbose=verbose,
upvoted=upvoted,
all=all,
version=False
)
import export_saved
# run
Expand Down

0 comments on commit 64a37f6

Please sign in to comment.