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

Add --dry-run and --verbose flags #23

Merged
merged 1 commit into from
Jun 24, 2021
Merged

Add --dry-run and --verbose flags #23

merged 1 commit into from
Jun 24, 2021

Conversation

silphid
Copy link
Owner

@silphid silphid commented Jun 22, 2021

No description provided.

@silphid silphid changed the base branch from master to network-mode-and-host-env June 22, 2021 23:26
@silphid silphid requested a review from davidmdm June 22, 2021 23:27
if options.Reset {
if options.Verbose {
fmt.Fprintf(os.Stderr, "removing container first")
}
if err := docker.Remove(ctx, containerName); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just realized there is a bug here. What if we run with reset but the container doesn't exist? We don't want to fail. Not to do with the PR but just thought I would flag it. I probably wrote the bug.

if err := docker.Remove(ctx, containerName); err != nil {
return fmt.Errorf("failed to remove container %q: %w", containerName, err)
}
}

var runOptions []docker.RunOption
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can probably do away with creating an options slice since all options accept their values. we can pass the empty string to WithWorkDir because even if we dont't pass the option it probably initialises the backing option to empty string anyways.

if options.Verbose {
fmt.Fprintln(os.Stderr)
}
if !options.DryRun {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dry-run does not print the banner but still starts the docker process? Wouldn't the flag be --no-banner?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm

Base automatically changed from network-mode-and-host-env to master June 24, 2021 15:17
@silphid silphid merged commit 210b9ae into master Jun 24, 2021
@silphid silphid deleted the dry-run-and-verbose branch June 24, 2021 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants