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

feat(cli): file is optional #65

Merged
merged 4 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Examples of these are:
### Rule names
Obtain the names of the currently implemented rules with:
```bash
amarna --show-rules .
amarna --show-rules
```

### Rule allowlist
Expand Down
6 changes: 5 additions & 1 deletion amarna/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def main() -> int:
metavar="-f",
type=str,
help="the name of the .cairo file or directory with .cairo files to analyze",
nargs="?",
)

parser.add_argument("-p", "--print", action="store_true", help="print output")
0xLucqs marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -149,9 +150,12 @@ def main() -> int:

filename = args.filename

if not os.path.isabs(filename):
if filename is not None and not os.path.isabs(filename):
0xLucqs marked this conversation as resolved.
Show resolved Hide resolved
filename = os.path.join(os.getcwd(), filename)

if not os.path.exists(filename):
raise Exception("The specified file doesn't exist")
0xLucqs marked this conversation as resolved.
Show resolved Hide resolved

rule_set_names: List[str] = get_rule_names(args.rules, args.exclude_rules)

results: List[Union[Result, ResultMultiplePositions]]
Expand Down