-
Notifications
You must be signed in to change notification settings - Fork 65
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
fix: Fixed cli command for memo parameter #446
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a165d9d
start
1cc959a
refactored command
0c4569b
refactored
305119a
deleted preparat_ft_transfer
bcbe10c
refactored
43a6edb
refactored args_ft_transfer
3859395
Merge branch 'main' into update-for-memo-option
FroVolod f139a9e
Update src/commands/tokens/send_ft/mod.rs
FroVolod 2ca5b60
Update src/commands/tokens/send_ft/mod.rs
FroVolod 4073e24
refactored
a78105a
Merge branch 'main' into update-for-memo-option
FroVolod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#[derive(Debug, Default, Clone)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need this type? I think, it's a bit weird There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleted |
||
pub struct OptionalString(Option<String>); | ||
|
||
impl std::fmt::Display for OptionalString { | ||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
if let Some(s) = &self.0 { | ||
s.fmt(f) | ||
} else { | ||
write!(f, "") | ||
} | ||
} | ||
} | ||
|
||
impl std::str::FromStr for OptionalString { | ||
type Err = color_eyre::eyre::ErrReport; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
let trimmed = s.trim(); | ||
if trimmed.is_empty() { | ||
Ok(Self(None)) | ||
} else { | ||
Ok(Self(Some(trimmed.to_lowercase()))) | ||
} | ||
} | ||
} | ||
|
||
impl From<OptionalString> for Option<String> { | ||
fn from(item: OptionalString) -> Self { | ||
item.0 | ||
} | ||
} | ||
|
||
impl From<Option<String>> for OptionalString { | ||
fn from(item: Option<String>) -> Self { | ||
Self(item) | ||
} | ||
} | ||
|
||
impl interactive_clap::ToCli for OptionalString { | ||
type CliVariant = OptionalString; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I would prefer this to be honest, over custom type that is not needed yet in the end.
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.
Done