lib/u3d/commands_generator.rb in u3d-0.9.3 vs lib/u3d/commands_generator.rb in u3d-0.9.4
- old
+ new
@@ -26,10 +26,11 @@
HighLine.track_eof = false
module U3d
# CLI using commander gem for u3d
+ # rubocop:disable ClassLength
class CommandsGenerator
include Commander::Methods
UI = U3dCore::UI
def self.start
@@ -69,11 +70,11 @@
# Meant to fetch options after '--' unknown by CommandsGenerator
run_args = extract_run_args
c.syntax = 'u3d run [-u | --unity_version <version>] [-r | --raw_logs] [ -- <run_args>]'
c.description = 'Run unity, and parses its output through u3d\'s log prettifier'
- c.option '-u', '--unity_version STRING', String, 'Version of Unity to run with'
+ c.option '-u', '--unity_version STRING', String, 'Version of Unity to run with. If not specified, it runs with the version of the project (either specified as -projectpath or current)'
c.option '-r', '--raw_logs', 'Raw Unity output, not filtered by u3d\'s log prettifier'
c.action do |args, options|
UI.user_error! "Run doesn't take arguments. Did you forget '--' or did you mistake your command? (#{args})" if args.count > 0
U3dCore::Globals.log_timestamps = true
Commands.run(options: convert_options(options), run_args: run_args)
@@ -93,11 +94,11 @@
command :available do |c|
oses = U3dCore::Helper.operating_systems
c.syntax = 'u3d available [-r | --release_level <level>] [-o | --operating_system <OS>] [-u | --unity_version <version>] [-p | --packages] [-f | --force]'
levels = Commands.release_levels
c.option '-f', '--force', 'Force refresh list of available versions'
- c.option '-r', '--release_level STRING', String, "Checks for availability on specific release level [#{levels.join(',')}]"
+ c.option '-r', '--release_level STRING', String, "Checks for availability on specific release level [#{levels.join(', ')}]"
c.option '-o', '--operating_system STRING', String, "Checks for availability on specific OS [#{oses.join(', ')}]"
c.option '-u', '--unity_version STRING', String, 'Checks if specified version is available'
c.option '-p', '--packages', 'Lists available packages as well'
c.example 'List all versions available, forcing a refresh of the available packages from Unity servers', 'u3d available -f'
c.example 'List stable versions available', 'u3d available -r stable -p'
@@ -109,38 +110,36 @@
Commands.list_available(options: convert_options(options))
end
end
command :install do |c|
- c.syntax = 'u3d install <version> [ [-p | --packages <package> ...] | [-a | --all] ] [ [-n | --no_install] [-i | --installation_path <path>] ]'
- c.description = "Download (and install) Unity3D packages."
- c.option '-p', '--packages PACKAGES', Array, 'Specifies which packages to download. Overriden by --all'
- c.option '-i', '--installation_path PATH', String, 'Specifies where package(s) will be installed. Overriden by --no_install'
- c.option '-a', '--all', 'Download all available packages'
- c.option '-n', '--no_install', 'No installation after download success'
+ c.syntax = 'u3d install [<version>] [ [-p | --packages <package> ...] | [-a | --all] ] [ [-n | --no_install] [-i | --installation_path <path>] ]'
+ c.summary = "Download (and/or) install Unity3D packages."
+ c.description = %(
+#{c.summary}
+
+This command allows you to either:
+* download and install packages
+* download packages but not install them
+* install already downloaded packages
+ )
+ c.option '--[no-]download', 'Perform or not downloading before installation. Downloads by default'
+ c.option '--[no-]install', 'Perform or not installation after downloading. Installs by default'
+ c.option '-p', '--packages PACKAGES', Array, 'Specifies which packages to download/install. Overriden by --all'
+ c.option '-a', '--all', 'Download all available packages. Overrides -p'
+ c.option '-X', '--installation_path PATH', String, 'Specifies where package(s) will be downloaded/installed. Conflicts with --no-install'
c.option '-k', '--keychain', 'Gain privileges right through the keychain. [OSX only]'
c.example 'Download and install Unity, its Documentation and the Android build support and install them for version 5.1.2f1', 'u3d install 5.1.2f1 -p Unity,Documentation,Android'
- c.example "The 'version' argument can be a specific version number, such as 5.6.1f1, or an alias in [#{Commands.release_letter_mapping.keys.join(',')}]", 'u3d install latest'
+ c.example "The 'version' argument can be a specific version number, such as 5.6.1f1, or an alias in [#{Commands.release_letter_mapping.keys.join(', ')}]. If not specified, u3d will download the unity version for the current project", 'u3d install latest'
c.action do |args, options|
options.default all: false
- options.default no_install: false
- Commands.download(args: args, options: convert_options(options))
+ options.default install: true
+ options.default download: true
+ Commands.install(args: args, options: convert_options(options))
end
end
- command :local_install do |c|
- c.syntax = 'u3d local_install <version> [ [-p | --packages <package> ...] | [-a | --all] ] [-i | --installation_path <path>]'
- c.description = 'Install downloaded version of Unity3d'
- c.option '-p', '--packages PACKAGES', Array, 'Specifies which packages to install. Overriden by --all'
- c.option '-i', '--installation_path PATH', String, 'Specifies where package(s) will be installed.'
- c.option '-a', '--all', 'Install all downloaded packages'
- c.option '-k', '--keychain', 'Gain privileges right through the keychain. [OSX only]'
- c.action do |args, options|
- Commands.local_install(args: args, options: convert_options(options))
- end
- end
-
command :credentials do |c|
c.syntax = "u3d credentials <#{Commands.credentials_actions.join(' | ')}>"
c.description = 'Manages keychain credentials so u3d remembers them. [OSX only]'
c.action do |args, options|
Commands.credentials(args: args, options: convert_options(options))
@@ -158,6 +157,7 @@
default_command :run
run!
end
end
+ # rubocop:enable ClassLength
end