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
Dry run mode #72
Dry run mode #72
Changes from 5 commits
eba8ce9
0b7220d
3ab5e94
67da043
3c6b363
31df1c6
bc9ec2e
e2b3d45
75a1c91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,15 @@ def main(): | |
default=88, | ||
) | ||
|
||
parser.add_argument( | ||
"-d", | ||
"--dry-run", | ||
action="store_true", | ||
default=False, | ||
help="Do not change the file in-place. Note that this must be used in " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When suggesting this change, I didn't consider we will end up implementing printing diff. Now it's more relevant to state that proposed diff will be printed to stdout, and --dry-run because useful on it's own without --fail-on-change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be fixed now. |
||
"conjunction with '--fail-on-change' when used for linting purposes." | ||
) | ||
|
||
parser.add_argument( | ||
"-tc", | ||
"--transform-concats", | ||
|
@@ -91,6 +100,9 @@ def main(): | |
|
||
args = parser.parse_args() | ||
|
||
if args.dry_run: | ||
print('Running flynt in dry-run mode. No files will be changed.') | ||
|
||
if args.transform_concats: | ||
if sys.version_info < (3, 8): | ||
raise Exception( | ||
|
@@ -101,6 +113,7 @@ def main(): | |
state.aggressive = args.aggressive | ||
state.verbose = args.verbose | ||
state.quiet = args.quiet | ||
state.dry_run = args.dry_run | ||
|
||
return fstringify( | ||
args.src, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why -n? I am using the first letter as a short-hand for each flag; -d would be more consistent (and intuitive imo)