lib/u3d/commands_generator.rb in u3d-1.0.20 vs lib/u3d/commands_generator.rb in u3d-1.0.21

- old
+ new

@@ -31,14 +31,24 @@ # rubocop:disable ClassLength class CommandsGenerator include Commander::Methods UI = U3dCore::UI + UNICODE_FILE = File.expand_path('../../assets/utf8.txt', __FILE__) + def self.start + check_locale new.run end + def self.check_locale + File.read(UNICODE_FILE).split("\n") + rescue ArgumentError => _e + UI.important "WARNING! Your Locale system appears to be incompatible with Unicode. Set you LOCALE appropriately" + UI.important "See https://github.com/DragonBox/u3d#setup" + end + def extract_run_args(args = ARGV) both_args = [[], []] idx = 0 args.each do |arg| if arg == '--' @@ -207,9 +217,35 @@ E.g. U3D_RULES_PATH=my_rules.json u3d prettify ... Fore more information about how the rules work, see https://github.com/DragonBox/u3d/blob/master/LOG_RULES.md ) c.action do |args, _options| Commands.local_analyze(args: args) + end + end + + command :console do |c| + c.syntax = 'u3d console' + c.summary = "Run an interactive console" + c.action do |_args, _options| + Commands.console + end + end + + command :move do |c| + c.syntax = 'u3d move [--dry_run] --long <version>' + # c.option '-f', '--force', Array, 'Specifies which packages to download/install. Overriden by --all' + c.option '-l', '--long', "Rename the installation dir into its long name pattern, namely #{U3d::UNITY_DIR_LONG} on Windows/Mac and #{U3d::UNITY_DIR_LINUX_LONG} on Linux" + c.option '--dry_run', "show what would have happened" + c.summary = "Move an existing Unity install to an optionally specified new folder, marking it as non moveable later on" + c.description = %( + #{c.summary} + Sometimes you want to move Unity to a different folder/path and let u3d stop modifying trying to move it around. + + The current command only supports 'long' installation dir names, containing not only the version but also the build number. + See https://github.com/DragonBox/u3d#unity-build-numbers for more information. + ) + c.action do |args, options| + Commands.move(args: args, options: convert_options(options)) end end default_command :run