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

CLI program argument parsing fails if colon in program args #75

Closed
jayvdb opened this issue Jul 15, 2022 · 3 comments
Closed

CLI program argument parsing fails if colon in program args #75

jayvdb opened this issue Jul 15, 2022 · 3 comments

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Jul 15, 2022

When a program is invoked with args containing a colon (:), the arg parser sets endpoint_index to be the program arg containing the colon, and in my case that resulted in this backtrace:

$ jgo mvxcvi:cljstyle fix C:/path/to/file
INFO 2022-07-14 16:01:28,175: First time start-up may be slow. Downloaded dependencies will be cached for shorter start-up times in subsequent executions.
Traceback (most recent call last):
  File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python310\Scripts\jgo.exe\__main__.py", line 7, in <module>
  File "C:\Python310\lib\site-packages\jgo\jgo.py", line 406, in _jgo_main
    completed_process = run(parser, argv=argv, stdout=stdout, stderr=stderr)
  File "C:\Python310\lib\site-packages\jgo\jgo.py", line 769, in run
    primary_endpoint, workspace = resolve_dependencies(
  File "C:\Python310\lib\site-packages\jgo\jgo.py", line 577, in resolve_dependencies
    os.makedirs(workspace, exist_ok=True)
  File "C:\Python310\lib\os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "C:\Python310\lib\os.py", line 225, in makedirs
    mkdir(name, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:/path/to/file\\RELEASE'

Presumably that backtrace indicates there is a need for resolve_dependencies to better handle strange input, but the more pressing problem is that the arg parsing needs to be improved so that there are no constraints on the program args which jgo should ignore.

@ctrueden
Copy link
Member

With #74 merged, is this bug addressed for you now @jayvdb?

@jayvdb
Copy link
Contributor Author

jayvdb commented Jul 31, 2022

Let me port my tests for this on top of the solution we have in #74.

And I've been working on an alternative solution for #76 . I'll take another crack at that now that we have decent tests for the cli.

@jayvdb
Copy link
Contributor Author

jayvdb commented Aug 1, 2022

#80 adds tests for this.
But the bug is solved. Closing now.

@jayvdb jayvdb closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants