Skip to content

Commit

Permalink
feat(cli): check if file is specified and exists
Browse files Browse the repository at this point in the history
  • Loading branch information
0xLucqs committed Aug 9, 2022
1 parent 053604c commit 87fb354
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions amarna/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def main() -> int:
metavar="-f",
type=str,
help="the name of the .cairo file or directory with .cairo files to analyze",
nargs="?"
nargs="?",
)

parser.add_argument("-p", "--print", action="store_true", help="print output")
Expand Down Expand Up @@ -150,9 +150,11 @@ def main() -> int:

filename = args.filename

if not os.path.isabs(filename):
if filename is not None and not os.path.isabs(filename):
filename = os.path.join(os.getcwd(), filename)

if not os.path.exists(filename):
raise Exception("The specified file doesn't exist")
rule_set_names: List[str] = get_rule_names(args.rules, args.exclude_rules)

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

0 comments on commit 87fb354

Please sign in to comment.