| |
---|
| | auto common_args = new CommandArgs(args[1..$]); |
---|
| | |
---|
| | try handler.prepareOptions(common_args); |
---|
| | catch (Exception e) { |
---|
| | if (options.noColors && options.forceColors) { |
---|
| | logError("Incompatible options: --no-colors and --force-colors"); |
---|
| | logInfo("Run 'dub help' for usage information."); |
---|
| | } |
---|
| | |
---|
| | // based on --no-colors or --force-colors we override whether initLogging() |
---|
| | // enabled colors or not in the first place |
---|
| | if (options.noColors) setLoggingColorsEnabled(false); |
---|
| | if (options.forceColors) setLoggingColorsEnabled(true); |
---|
| | logError("Error processing arguments: %s", e.msg); |
---|
| | logDiagnostic("Full exception: %s", e.toString().sanitize); |
---|
| | logInfo("Run 'dub help' for usage information."); |
---|
| | return 1; |
---|
| |
---|
| | /** Contains and parses options common to all commands. |
---|
| | */ |
---|
| | struct CommonOptions { |
---|
| | bool verbose, vverbose, quiet, vquiet, verror, version_; |
---|
| | bool help, annotate, bare, noColors; |
---|
| | bool help, annotate, bare, noColors, forceColors; |
---|
| | string[] registry_urls; |
---|
| | string root_path; |
---|
| | SkipPackageSuppliers skipRegistry = SkipPackageSuppliers.none; |
---|
| | PlacementLocation placementLocation = PlacementLocation.user; |
---|
| |
---|
| | args.getopt("q|quiet", &quiet, ["Only print warnings and errors"]); |
---|
| | args.getopt("verror", &verror, ["Only print errors"]); |
---|
| | args.getopt("vquiet", &vquiet, ["Print no messages"]); |
---|
| | args.getopt("no-colors", &noColors, ["Disable color output"]); |
---|
| | args.getopt("force-colors", &forceColors, ["Force output to be always colored"]); |
---|
| | args.getopt("cache", &placementLocation, ["Puts any fetched packages in the specified location [local|system|user]."]); |
---|
| | |
---|
| | version_ = args.hasAppVersion; |
---|
| | } |
---|
| |
---|
| | |