Skip to content

Commit

Permalink
Support quotes in version input
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Feb 25, 2021
1 parent 62b8d3c commit 57b4b22
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/newversion/cli_parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Parsed version.

## parse_args

[[find in source code]](https://github.com/vemel/newversion/blob/main/newversion/cli_parser.py#L30)
[[find in source code]](https://github.com/vemel/newversion/blob/main/newversion/cli_parser.py#L31)

```python
def parse_args(args: Sequence[str]) -> argparse.Namespace:
Expand Down
3 changes: 2 additions & 1 deletion newversion/cli_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def get_stdin() -> Version:
return Version.zero()

for line in sys.stdin.readlines():
return Version(line.strip().split(" ")[-1])
safe_line = line.strip().split(" ")[-1].replace('"', "").replace("'", "")
return Version(safe_line)

return Version.zero()

Expand Down
4 changes: 2 additions & 2 deletions scripts/before_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ set -e
ROOT_PATH=$(dirname $(dirname $0))
cd $ROOT_PATH

npx pyright
pytest
black .
isort .
npx pyright
pytest
flake8 newversion

./scripts/docs.sh

0 comments on commit 57b4b22

Please sign in to comment.