Example #1
0
        public void Run()
        {
            if (Args.Length > 0 && (Args[0] == "-h" || Args[0] == "--help"))
            {
                ShowHelp();
                return;
            }

            GitUtils.CheckIfRepository();

            if (Args.Length == 0)
            {
                StartMultiSelectClean();
                return;
            }

            if (Args.Length == 1 && (Args[0] == "-a" || Args[0] == "--auto"))
            {
                StartAutoClean();
                return;
            }

            if (Args.Length == 3 &&
                (Args[0] == "-a" || Args[0] == "--auto") &&
                (Args[1] == "-p" || Args[1] == "--protect") &&
                Args[2].Length > 0)
            {
                StartAutoClean(Args[2]);
                return;
            }

            HandleUnknownParam();
        }
Example #2
0
        public void Run()
        {
            if (Args.Length == 1 && (Args[0] == "-h" || Args[0] == "--help"))
            {
                ShowHelp();
                return;
            }

            GitUtils.CheckIfRepository();

            if (Args.Length == 0)
            {
                ShowUser(isGlobal: false);
                return;
            }

            if (Args.Length == 1 && (Args[0] == "-g" || Args[0] == "--global"))
            {
                ShowUser(isGlobal: true);
                return;
            }

            if (Args.Length == 1 && (Args[0] == "-p" || Args[0] == "--personal"))
            {
                SetUser(isGlobal: false, config: UserConfig.Personal);
                return;
            }

            if (Args.Length == 1 && (Args[0] == "-w" || Args[0] == "--work"))
            {
                SetUser(isGlobal: false, config: UserConfig.Work);
                return;
            }

            if (
                Args.Length == 2 &&
                (Args.Contains("-g") || Args.Contains("--global")) &&
                (Args.Contains("-p") || Args.Contains("--personal"))
                )
            {
                SetUser(isGlobal: true, config: UserConfig.Personal);
                return;
            }

            if (
                Args.Length == 2 &&
                (Args.Contains("-g") || Args.Contains("--global")) &&
                (Args.Contains("-w") || Args.Contains("--work"))
                )
            {
                SetUser(isGlobal: true, config: UserConfig.Work);
                return;
            }

            HandleUnknownParam();
        }
Example #3
0
        public void Run()
        {
            if (Args.Length == 1 && (Args[0] == "-h" || Args[0] == "--help"))
            {
                ShowHelp();
                return;
            }

            if (Args.Length != 0)
            {
                HandleUnknownParam();
            }

            GitUtils.CheckIfRepository();
            PullOriginHead();
        }
Example #4
0
        public void RunShortcut(string action)
        {
            GitUtils.CheckIfRepository();
            using Repository repo = new Repository(Environment.CurrentDirectory);

            Branch branch;

            try
            {
                branch = repo.Branches.First(b => !b.IsRemote && IsRequiredBranch(action, b));
            }
            catch (Exception e)
            {
                if (e is InvalidOperationException)
                {
                    branch = null;
                }
                else
                {
                    throw;
                }
            }

            if (branch == null)
            {
                Log.Error("No such branch found.");
                return;
            }

            GitUtils.CheckOutBranch(repo, branch);
            GitUtils.ShowLatestCommit(repo);

            if (Args.Length == 1 && Args[0] == "-r")
            {
                GitUtils.PerformPull(branch.FriendlyName);
                GitUtils.ShowLatestCommit(repo);
                return;
            }

            if (Args.Length > 0)
            {
                HandleUnknownParam();
            }
        }
Example #5
0
        public void Run()
        {
            if (Args.Length == 1 && (Args[0] == "-h" || Args[0] == "--help"))
            {
                ShowHelp();
                return;
            }

            GitUtils.CheckIfRepository();

            if (Args.Length == 0)
            {
                StartSelectCheckout();
                return;
            }

            if (Args.Length == 1)
            {
                StartCheckout(Args[0]);
                return;
            }

            HandleUnknownParam();
        }