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

no preview of changes when noPrompt is true #300

Closed
rafmeeusen opened this issue Jul 23, 2015 · 4 comments
Closed

no preview of changes when noPrompt is true #300

rafmeeusen opened this issue Jul 23, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@rafmeeusen
Copy link

Hi,

I noticed that when running drive non-interactive or when using -no-prompt,
the preview of changes is not sent to stdout.

Not sure if this was intended or not, but I would expect that no-prompt to only have impact on the reading of stdin for continuing or not, and not have impact on what is printed to stdout.

I changed this behavior in my fork (branch always_previewing). Not sure if you're interested and/or if I'm not breaking anything.

best regards,
Raf

@odeke-em
Copy link
Owner

Hello @rafmeeusen, welcome to drive and thank you for reporting this issue as well as working on it!

Yes in deed, this sounds like reasonable behaviour to have and you are onto something. The only twist is that if say you are piping output to a non-tty or so, you don't need to provide a preview. Also currently --no-prompt couples with method

// file src/changes.go
func (opts *Options) canPrompt() bool {
    if opts == nil || !opts.StdoutIsTty {
        return false
    }
    if opts.Quiet {
        return false
    }
    return !opts.NoPrompt
}

So a possible way to get this behaviour in correctly would be to add a similar method say canPreview() and then couple that in the way that canPrompt is used.

Please let me know if this makes sense.

@pefoley2
Copy link

pefoley2 commented Aug 9, 2015

I'm also running into this.
I run drive as part of a nightly cron job, and it would be nice to see what happens even if I'm passing -no-prompt.

@rafmeeusen
Copy link
Author

Hi @odeke-em, sorry had no time yet to look at your proposal, but I already can point out that I have the same use case as pefoley2 : auto-running drive / would like to have a log (i.e. stdout/stderr) saved to file.

@odeke-em
Copy link
Owner

Hello folks, thanks for the patience and for reporting this bug. I've fixed it in #439. Please get the latest from master, it should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants