Commit MetaInfo

Revisão9ffb4d214856f039b9177b3fad8a1160fe528fcc (tree)
Hora2018-10-29 19:28:41
AutorTatsuki Sugiura <sugi@nemu...>
CommiterTatsuki Sugiura

Mensagem de Log

Package and release command gets target from vars file.

Mudança Sumário

Diff

--- a/lib/osdn/cli/command/package.rb
+++ b/lib/osdn/cli/command/package.rb
@@ -5,8 +5,8 @@ module OSDN; module CLI; module Command
55 def help
66 puts "#{$0} package [opts] [list]"
77 puts "#{$0} package [opts] create <new-package-name>"
8- puts "#{$0} package [opts] update <numeric-package-id> [name]"
9- puts "#{$0} package [opts] delete <numeric-package-id>"
8+ puts "#{$0} package [opts] update [numeric-package-id] [name]"
9+ puts "#{$0} package [opts] delete [numeric-package-id]"
1010 puts "Options:"
1111 puts " -f --format=<pretty|json> Set output format"
1212 puts " -p --project=<project> Target project (numeric id or name)"
@@ -65,20 +65,29 @@ module OSDN; module CLI; module Command
6565 end
6666
6767 def update
68- target_id = ARGV.shift
69- args = {name: ARGV.shift}
68+ _set_package_id
69+ args = {}
70+ if ARGV[1].to_s != ""
71+ args[:name] = ARGV[1]
72+ end
7073 if @visibility
7174 args[:visibility] = @visibility
7275 end
73- p = api.update_package target_proj, target_id, args
74- logger.info "Package #{target_id} has been updated."
76+ logger.debug "Updating package #{target_package} as #{args.inspect}"
77+ p = api.update_package target_proj, target_package, args
78+ logger.info "Package #{target_package} has been updated."
7579 puts format_package(p)
7680 end
7781
7882 def delete
79- target_id = ARGV.shift
80- p = api.delete_package target_proj, target_id
81- logger.info "Package #{target_id} has been deleted."
83+ _set_package_id
84+ p = api.delete_package target_proj, target_package
85+ logger.info "Package #{target_package} has been deleted."
86+ end
87+
88+ def _set_package_id
89+ return if ARGV[0].to_i == 0
90+ @target_package = ARGV[0].to_i
8291 end
8392
8493 end
--- a/lib/osdn/cli/command/release.rb
+++ b/lib/osdn/cli/command/release.rb
@@ -5,8 +5,8 @@ module OSDN; module CLI; module Command
55 def help
66 puts "#{$0} release [opts] [list]"
77 puts "#{$0} release [opts] create <new-release-name>"
8- puts "#{$0} release [opts] update <numeric-release-id> [name]"
9- puts "#{$0} release [opts] delete <numeric-release-id>"
8+ puts "#{$0} release [opts] update [numeric-release-id] [name]"
9+ puts "#{$0} release [opts] delete [numeric-release-id]"
1010 puts "Options:"
1111 puts " -f --format=<pretty|json> Set output format"
1212 puts " -p --project=<project> Target project (numeric id or name)"
@@ -71,21 +71,29 @@ module OSDN; module CLI; module Command
7171 end
7272
7373 def update
74- target_id = ARGV.shift
75- args = {name: ARGV.shift}
74+ _set_release_id
75+ args = {}
76+ if ARGV[1].to_s != ""
77+ args[:name] = ARGV.shift
78+ end
7679 if @visibility
7780 args[:visibility] = @visibility
7881 end
79- r = api.update_release target_proj, target_package, target_id, args
80- logger.info "Release #{target_id} has been updated."
82+ logger.debug "Updating release #{target_release} as #{args.inspect}"
83+ r = api.update_release target_proj, target_package, target_release, args
84+ logger.info "Release #{target_release} has been updated."
8185 puts format_release(r)
8286 end
8387
8488 def delete
85- target_id = ARGV.shift
86- r = api.delete_release target_proj, target_package, target_id
87- logger.info "Release #{target_id} has been deleted."
89+ _set_release_id
90+ r = api.delete_release target_proj, target_package, target_release
91+ logger.info "Release #{target_release} has been deleted."
8892 end
8993
94+ def _set_release_id
95+ return if ARGV[0].to_i == 0
96+ @target_release = ARGV[0].to_i
97+ end
9098 end
9199 end; end; end
Show on old repository browser