-
Notifications
You must be signed in to change notification settings - Fork 185
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 deprecation info of version
flag
#2834
base: master
Are you sure you want to change the base?
Add deprecation info of version
flag
#2834
Conversation
…-v3-in-sncast-commands-that-accept---version
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.
It think this would be more readable instead of current macro
use anyhow::Error;
use clap::ValueEnum;
use shared::print::print_as_warning;
const DEPRECATION_MESSAGE: &str = "The '--version' flag is deprecated and will be removed in the future. Version 3 will become the only type of transaction available.";
pub fn parse_version<T: ValueEnum>(s: &str) -> Result<T, String> {
print_as_warning(&Error::msg(DEPRECATION_MESSAGE));
let ignore_case = false; // please check if it should be true of false to not make breaking changes
T::from_str(s, ignore_case)
}
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.
Additionally, I think it would be better to change the signature of print_as_warning
from:
pub fn print_as_warning(error: &Error)
to:
pub fn print_as_warning(error: impl Display)
This way, we wouldn't need to use the awkward workaround &Error::msg(DEPRECATION_MESSAGE)
and could simply pass DEPRECATION_MESSAGE
directly 😊
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.
Cool, it will simplify a lot, also some tests can be removed then
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.
- Shouldn't we update this message then? If someone uses
--token
we sayUse '--version' instead
while version will be deprecated too. I think we can just removeUse '--version' instead
sentence. - CI is failing 👀
Otherwise looks fine 👍
…-v3-in-sncast-commands-that-accept---version
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.
Please resolve conflicts in changelog
Closes #2828
Introduced changes
Checklist
CHANGELOG.md