-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Sample code for the Click article #415
Conversation
python-click/add.py
Outdated
def cli(): | ||
a = click.prompt("Enter an integer", type=click.INT, default=0) | ||
b = click.prompt("Enter another integer", type=click.INT, default=0) | ||
|
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.
Do we need this extra blank line here?
cli.add_command(commands.sub) | ||
cli.add_command(commands.mul) | ||
cli.add_command(commands.div) | ||
|
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.
There should be two blank lines here for consistency.
cli.add_command(commands.sub) | ||
cli.add_command(commands.mul) | ||
cli.add_command(commands.div) | ||
|
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.
Should there be two blank lines here as well?
python-click/nasa.py
Outdated
@@ -0,0 +1,40 @@ | |||
# nasa.py |
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.
This comment is redundant.
python-click/greet.py
Outdated
@click.option( | ||
"--name", | ||
multiple=True, | ||
) |
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.
Collapse these into a single line?
python-click/ls_v4.py
Outdated
if i < len(paths) - 1: | ||
click.echo() |
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.
Suggested change:
if i < len(paths) - 1: | |
click.echo() | |
if i < len(paths) - 1: | |
click.echo("" if long else "\n") | |
elif not long: | |
click.echo() |
python-click/ls_v5.py
Outdated
for entry in path.iterdir(): | ||
entry_output = build_output(entry, long) | ||
click.echo(f"{entry_output:{len(entry_output) + 5}}", nl=long) | ||
click.echo("\n") |
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.
Suggested change:
click.echo("\n") | |
if i < len(paths) - 1: | |
click.echo("" if long else "\n") | |
elif not long: | |
click.echo() |
python-click/ls_v6.py
Outdated
for entry in path.iterdir(): | ||
entry_output = build_output(entry, long) | ||
click.echo(f"{entry_output:{len(entry_output) + 5}}", nl=long) | ||
click.echo("\n") |
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.
Suggested change:
click.echo("\n") | |
if i < len(paths) - 1: | |
click.echo("" if long else "\n") | |
elif not long: | |
click.echo() |
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.
@lpozo Hey, I'm approving this PR but I wanted to let you know that I left some suggestions for you.
Where to put new files:
my-awesome-article
How to merge your changes: