lib/zold/commands/push.rb in zold-0.6.3 vs lib/zold/commands/push.rb in zold-0.6.4
- old
+ new
@@ -16,13 +16,15 @@
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+require 'rainbow'
require 'slop'
require 'json'
require 'net/http'
+require_relative 'args'
require_relative '../log'
require_relative '../id'
require_relative '../http'
# PUSH command.
@@ -42,15 +44,11 @@
opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
o.banner = "Usage: zold push [ID...] [options]
Available options:"
o.bool '--help', 'Print instructions'
end
- if opts.help?
- @log.info(opts.to_s)
- return
- end
- mine = opts.arguments[1..-1]
- raise 'At least one wallet ID is required' if mine.empty?
+ mine = Args.new(opts, @log).take || return
+ mine = @wallets.all if mine.empty?
mine.each do |id|
push(@wallets.find(Id.new(id)), opts)
end
end