Exemplo n.º 1
0
    /// <summary>
    /// Creates a new run command.
    /// </summary>
    /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
    public Run(ICommandHandler handler)
        : base(handler, outputOptions: false)
    {
        Options.Add("m|main=", () => Resources.OptionMain, newMain => _overrideMain     = newMain);
        Options.Add("w|wrapper=", () => Resources.OptionWrapper, newWrapper => _wrapper = newWrapper);
        Options.Add("no-wait", () => Resources.OptionNoWait, _ => _noWait = true);

        // Work-around to disable interspersed arguments (needed for passing arguments through to sub-processes)
        Options.Add("<>", value =>
        {
            AdditionalArgs.Add(value);

            // Stop using options parser, treat everything from here on as unknown
            Options.Clear();
        });
    }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public override void Parse(IEnumerable <string> args)
        {
            if (Options.Parse(args).Count != 0)
            {
                throw new OptionException(Resources.TooManyArguments + "\n" + AdditionalArgs.JoinEscapeArguments(), "");
            }

            Requirements.InterfaceUri = Config.SelfUpdateUri;

            // Pass in the installation directory to the updater as an argument
            AdditionalArgs.Add(Locations.InstallBase);

            if (_restartCentral)
            {
                AdditionalArgs.Add("--restart-central");
            }
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        public Run([NotNull] ICommandHandler handler) : base(handler)
        {
            //Options.Remove("xml");
            //Options.Remove("show");

            Options.Add("m|main=", () => Resources.OptionMain, newMain => Executor.Main             = newMain);
            Options.Add("w|wrapper=", () => Resources.OptionWrapper, newWrapper => Executor.Wrapper = newWrapper);
            Options.Add("no-wait", () => Resources.OptionNoWait, _ => NoWait = true);

            // Work-around to disable interspersed arguments (needed for passing arguments through to sub-processes)
            Options.Add("<>", value =>
            {
                AdditionalArgs.Add(value);

                // Stop using options parser, treat everything from here on as unknown
                Options.Clear();
            });
        }
Exemplo n.º 4
0
            /// <inheritdoc/>
            public override void Parse(IEnumerable <string> args)
            {
                // NOTE: Does not call base method

                AdditionalArgs.AddRange(Options.Parse(args));
                if (AdditionalArgs.Count != 0)
                {
                    throw new OptionException(Resources.TooManyArguments + Environment.NewLine + AdditionalArgs.JoinEscapeArguments(), null);
                }

                SetInterfaceUri(Config.SelfUpdateUri ?? throw new UriFormatException(Resources.SelfUpdateDisabled));
                if (ProgramUtils.GuiAssemblyName != null)
                {
                    Requirements.Command = Command.NameRunGui;
                }

                // Instruct new version of Zero Install in the cache to deploy itself over the location of the current version
                AdditionalArgs.AddRange(new[] { Self.AltName, Deploy.Name, "--batch", Locations.InstallBase });

                if (_restartCentral)
                {
                    AdditionalArgs.Add("--restart-central");
                }
            }