Exemple #1
0
        static void Main(string[] args)
        {
            SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);
            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);

            if (!Wsl.CheckWsldImage())
            {
                Docker.InstallWsldImage();
                return;
            }

            string firstArg = args.Length > 0 ? args[0] : "";

            UserConfig.default_distro   = Commands.GetDefaultDistro();
            UserConfig.isLoggedToDocker = Commands.IsLoggedToDocker();

            switch (firstArg)
            {
            case "docker":
                DockerTree(args.Skip(1).ToArray());
                break;


            default:
                var cmdOptions = Parser.Default.ParseArguments <DefaultOptions>(args);
                cmdOptions.WithParsed(options => { DefaultOptionsMain(options); });
                break;
            }
        }
Exemple #2
0
        static bool DockerLogin_required()
        {
            if (Docker.DockerLogin(null, null))
            {
                Console.WriteLine("Login Succeed!, rerun the command!");
                return(true);
            }

            Console.WriteLine("User or Password incorrect");
            return(false);
        }
Exemple #3
0
        private static void ParsedMain(CmdOptions options)
        {
            string img = options.Dockerimage;
            var    rdt = Get_Repo_Dist_Tag(img);

            string repo       = rdt[0];
            string distroname = rdt[1];
            string tag        = rdt[2];

            if (options.InstallDir != null)
            {
                UserConfig.install_dir = options.InstallDir;
            }


            string install_tar_path = Docker.DownloadAndGenerateImage(repo, distroname, tag, options.Distroname);

            Wsl.InstallImage(install_tar_path, Path.Combine(UserConfig.install_dir, options.Distroname), options.Distroname, options.Version);
        }
Exemple #4
0
        static bool DockerLogin(string[] args)
        {
            string firstArg = args.Length > 0 ? args[0] : "";

            bool retval = false;

            Parser.Default.ParseArguments <DockerLoginOptions>(args).WithParsed(options => {
                if (Docker.DockerLogin(options.User, options.Password))
                {
                    Console.WriteLine("Succeed!");
                    retval = true;
                }
                else
                {
                    Console.WriteLine("User or Password incorrect");
                }
            });
            return(retval);
        }