Skip to content

Commit

Permalink
Added: [pdftool] --version option
Browse files Browse the repository at this point in the history
  • Loading branch information
mypaceshun committed Dec 16, 2021
1 parent 3e24ca1 commit 35f78d9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions shuncommands/pdftool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@


@click.group()
@click.version_option(None, '-v', '--version')
@click.help_option('-h', '--help')
def ctx():
'''
\b
Expand All @@ -15,6 +17,8 @@ def ctx():


@ctx.command()
@click.version_option(None, '-v', '--version')
@click.help_option('-h', '--help')
@click.option('password', '-p',
help='decrypt password',
prompt=True,
Expand Down
16 changes: 15 additions & 1 deletion tests/test_pdftool.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,26 @@


class TestPdfTool():
def test_run(self):
def test_run_help(self):
runner = CliRunner()
res = runner.invoke(pdftool.ctx, ['--help'])
assert res.exit_code == 0

res = runner.invoke(pdftool.ctx, ['-h'])
assert res.exit_code == 0

def test_run_version(self):
runner = CliRunner()
res = runner.invoke(pdftool.ctx, ['--version'])
assert res.exit_code == 0

res = runner.invoke(pdftool.ctx, ['-v'])
assert res.exit_code == 0

def test_run_unlock(self):
runner = CliRunner()
res = runner.invoke(pdftool.ctx, ['unlock', '--help'])
assert res.exit_code == 0

res = runner.invoke(pdftool.ctx, ['unlock', '-h'])
assert res.exit_code == 0

0 comments on commit 35f78d9

Please sign in to comment.