-
Notifications
You must be signed in to change notification settings - Fork 112
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
Make plain-text spinner element avaialble via config #48
Conversation
This adds a PlainTextElement that has an interface like a TTY::Spinner but provides update-per-line plain text output. This is useful when debugging with pry while a spinner is running; without it, the spinner refreshes interfere with the IRB session. To enable this, add the following to config.toml: [dev] spinner="PlainTextElement" Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
params.each_pair do |k, v| | ||
msg.gsub!(/:#{k}/, v) | ||
end | ||
ChefWorkstation::Log.send(log_method, msg) |
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.
Note: I found this useful, but I'm thinking we should put it in StatusUpdater instead so that it's the default behavior regardless of the UI element in use.
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.
Yeah, agreed - I think it should go in StatusUpdater if we have it anywhere.
My future vision is that if you passed the equivalent of --force-logger
to the CLI, the spinner logic would be disabled completely and you would just get traditional log output on STDOUT. So in that case I think StatusUpdater handling it makes more sense. But we can definitely leave this here for now
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.
agree
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 has definitely bugged me many times before - thanks for introducing a fix!
params.each_pair do |k, v| | ||
msg.gsub!(/:#{k}/, v) | ||
end | ||
ChefWorkstation::Log.send(log_method, msg) |
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.
Yeah, agreed - I think it should go in StatusUpdater if we have it anywhere.
My future vision is that if you passed the equivalent of --force-logger
to the CLI, the spinner logic would be disabled completely and you would just get traditional log output on STDOUT. So in that case I think StatusUpdater handling it makes more sense. But we can definitely leave this here for now
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.
LGTM!
params.each_pair do |k, v| | ||
msg.gsub!(/:#{k}/, v) | ||
end | ||
ChefWorkstation::Log.send(log_method, msg) |
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.
agree
This adds a PlainTextElement that has an interface like a TTY::Spinner
but provides update-per-line plain text output.
This is useful when debugging with pry while a spinner
is running; without it, the spinner refreshes interfere
with the IRB session.
To enable this, add the following to config.toml:
Output example:
…ts/chef-workstation$ be chef target converge winrm://user:password@192.168.1.204 user user1
[ - ] [192.168.1.204] Connecting...
[ - ] [192.168.1.204] Connected.
[ - ] [192.168.1.204] Verifying Chef client installation.
[ - ] [192.168.1.204] Downloading Chef client installer.
[ - ] [192.168.1.204] Uploading Chef client installer.
[ - ] [192.168.1.204] Installing Chef client.
[ - ] [192.168.1.204] Chef client installation completed!
[ - ] [192.168.1.204] Converging user[user1]...
[ - ] [192.168.1.204] Successfully converged user[user1]!
Signed-off-by: Marc A. Paradise marc.paradise@gmail.com