-
Notifications
You must be signed in to change notification settings - Fork 53
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
Command handling implemented #323 #331
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,34 @@ def run(args = []) | |
mine = Args.new(opts, @log).take || return | ||
command = mine[0] | ||
raise "A command is required, try 'zold alias --help'" unless command | ||
case command | ||
when 'set' then set(mine[1], mine[2]) | ||
when 'remove' then remove(mine[1]) | ||
when 'show' then show(mine[1]) | ||
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.
|
||
end | ||
end | ||
|
||
# @todo #323:30min Implement the set command. | ||
# The set command expects 'wallet' which is the wallet id | ||
# and 'alias' (here called 'name' as alias is a Ruby keyword). | ||
# It writes this info into the alias file as described in #279. | ||
def set(_wallet, _name) | ||
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. @botanicus do tests exist for these? 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. Yes #330 |
||
raise NotImplementedError, 'This is not yet implemented' | ||
end | ||
|
||
# @todo #323:30min Implement the remove command. | ||
# The remove command expect an 'alias' (here called 'name' as alias | ||
# is a Ruby keyword). | ||
# It removes given alias from the alias file as described in #279. | ||
def remove(_name) | ||
raise NotImplementedError, 'This is not yet implemented' | ||
end | ||
|
||
# @todo #279:30min Implement command handling. As in other commands, | ||
# there should be case/when command/end loop and commands should be | ||
# implemented as methods. | ||
# @todo #323:30min Implement the show command. | ||
# The show command expect an 'alias' (here called 'name' as alias | ||
# is a Ruby keyword). | ||
# It prints out wallet id corresponding with given alias from the alias file as described in #279. | ||
def show(_name) | ||
raise NotImplementedError, 'This is not yet implemented' | ||
end | ||
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.
@botanicus please don't make us guess what
mine[1]
is, extract variables.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.
@ledestin it's how it's been used in other commands as well, for instance https://github.com/zold-io/zold/blob/master/lib/zold/commands/remote.rb#L120
If you think this is wrong, then it should be changed everywhere, not just here, in which case I think bug report is where it belongs.
I personally don't think there's anything wrong with it since they are named in both method signature and in the help just above it.
I'm not sure what @yegor256 thinks, I've seen something from him about avoiding unnecessary variables, but I cannot tell if this is one of the cases or not.
Anyhow ... since it's not specific to this code, I'd suggest a bug report. Makes sense?
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.
@botanicus sure!