Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version is not reported on CLI #424

Closed
ibnesayeed opened this issue Jul 8, 2018 · 5 comments
Closed

Version is not reported on CLI #424

ibnesayeed opened this issue Jul 8, 2018 · 5 comments
Labels

Comments

@ibnesayeed
Copy link
Member

Neither -v not --version flags seem to be working.

$ ipwb -v
usage: ipwb [-h] [-d DAEMON_ADDRESS] [-o OUTFILE] [-v] {index,replay} ...

InterPlanetary Wayback (ipwb)

optional arguments:
  -h, --help            show this help message and exit
  -d DAEMON_ADDRESS, --daemon DAEMON_ADDRESS
                        Location of ipfs daemon (default 127.0.0.1:5001)
  -o OUTFILE, --outfile OUTFILE
                        Filename of newly created CDXJ index file
  -v, --version         Report the version of ipwb

ipwb commands:
  Invoke using "ipwb <command>", e.g., ipwb replay

  {index,replay}
    index               Index a WARC file for replay in ipwb
    replay              Start the ipwb replay system
@ibnesayeed ibnesayeed added the bug label Jul 8, 2018
@machawk1
Copy link
Member

machawk1 commented Jul 8, 2018

Odd. I can replicate this bug. Maybe something is shadowing it from when we changed the replay and indexing sub-argparsing.

@ibnesayeed
Copy link
Member Author

This time a test would be easy to write for this one I guess.

@machawk1
Copy link
Member

machawk1 commented Jul 8, 2018

Good call but the version number will change and it's probably best that we don't have to maintain the test based on the version. Should we check for a string like "InterPlanetary Wayback v." in the output? Regex?

Let's use this ticket for a test-driven resolution with it failing once we create the test then resolved with the eventual PR.

@machawk1
Copy link
Member

machawk1 commented Jul 9, 2018

In __main__.py:

def checkArgs(argsIn):
  argCount = len(argsIn)
  cmdList = ['index', 'replay']
  ...
  cmdError_invalidCommand = argCount > 1 and argsIn[1] not in cmdList
  if cmdError_noCommand or cmdError_invalidCommand:
        parser.print_help()

With ipwb -v, argsIn is ['/usr/local/bin/ipwb', '-v']

@ibnesayeed
Copy link
Member Author

Good call but the version number will change and it's probably best that we don't have to maintain the test based on the version. Should we check for a string like "InterPlanetary Wayback v." in the output? Regex?

The point is, you don't make your test too rigid, but not too loose either. Just test what you expect to be there, be it a pattern, a prefix, or something else.

machawk1 added a commit that referenced this issue Jul 13, 2018
Consider version and daemon flag on base argparser. Closes #424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants