コード例 #1
0
ファイル: PyRevitCLI.cs プロジェクト: xulian070608/pyRevit
        // cli entry point:
        static void Main(string[] args)
        {
            // process arguments for logging level
            var argsList = new List <string>(args);

            // check for testing and set the global test flag
            if (argsList.Contains("--test"))
            {
                argsList.Remove("--test");
                GlobalConfigs.UnderTest = true;
            }

            // setup logger
            // process arguments for hidden debug mode switch
            PyRevitCLILogLevel logLevel = PyRevitCLILogLevel.InfoMessages;
            var config     = new LoggingConfiguration();
            var logconsole = new ConsoleTarget("logconsole")
            {
                Layout = @"${level}: ${message} ${exception}"
            };

            config.AddTarget(logconsole);
            config.AddRule(LogLevel.Error, LogLevel.Fatal, logconsole);

            if (argsList.Contains("--verbose"))
            {
                argsList.Remove("--verbose");
                logLevel = PyRevitCLILogLevel.InfoMessages;
                config.AddRule(LogLevel.Info, LogLevel.Info, logconsole);
            }

            if (argsList.Contains("--debug"))
            {
                argsList.Remove("--debug");
                logLevel = PyRevitCLILogLevel.Debug;
                config.AddRule(LogLevel.Debug, LogLevel.Debug, logconsole);
            }

            // config logger
            LogManager.Configuration = config;

            try {
                // process docopt
                // docopt raises exception if pattern matching fails
                arguments = new Docopt().Apply(UsagePatterns, argsList, exit: false, help: false);

                // print active arguments in debug mode
                if (logLevel == PyRevitCLILogLevel.Debug)
                {
                    PrintArguments(arguments);
                }

                // setup output log
                if (arguments["--log"] != null)
                {
                    var logfile = new FileTarget("logfile")
                    {
                        FileName = arguments["--log"].Value as string
                    };
                    config.AddTarget(logfile);
                    config.AddRuleForAllLevels(logfile);

                    arguments.Remove("--log");

                    // update logger config
                    LogManager.Configuration = config;
                }

                // check if requesting version
                IsVersionMode = arguments["--version"].IsTrue || arguments["-V"].IsTrue;

                // check if requesting help
                IsHelpMode = arguments["--help"].IsTrue || arguments["-h"].IsTrue;

                // check if requesting help with full usage patterns
                IsHelpUsagePatternMode = arguments["--usage"].IsTrue;

                try {
                    // now call methods based on inputs
                    ProcessArguments();

                    // process global error codes
                    ProcessErrorCodes();
                }
                catch (Exception ex) {
                    LogException(ex, logLevel);
                }

                // Flush and close down internal threads and timers
                LogManager.Shutdown();
            }
            catch (Exception ex) {
                // when docopt fails, print help
                logger.Debug("Arg processing failed. | {0}", ex.Message);
                PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Main);
            }
        }
コード例 #2
0
ファイル: PyRevitCLI.cs プロジェクト: xulian070608/pyRevit
        // cli argument processor
        private static void ProcessArguments()
        {
            if (IsHelpUsagePatternMode)
            {
                Console.WriteLine(UsagePatterns.Replace("\t", "    "));
            }

            else if (IsVersionMode)
            {
                PyRevitCLIAppCmds.PrintVersion();
            }

            else if (all("help"))
            {
                PyRevitCLIAppHelps.OpenHelp();
            }

            else if (all("blog"))
            {
                CommonUtils.OpenUrl(PyRevitConsts.BlogsUrl);
            }

            else if (all("docs"))
            {
                CommonUtils.OpenUrl(PyRevitConsts.DocsUrl);
            }

            else if (all("source"))
            {
                CommonUtils.OpenUrl(PyRevitConsts.SourceRepoUrl);
            }

            else if (all("youtube"))
            {
                CommonUtils.OpenUrl(PyRevitConsts.YoutubeUrl);
            }

            else if (all("support"))
            {
                CommonUtils.OpenUrl(PyRevitConsts.SupportRepoUrl);
            }

            else if (all("env"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Env);
                }
                else
                {
                    PyRevitCLIAppCmds.MakeEnvReport(json: arguments["--json"].IsTrue);
                }
            }

            else if (all("clone"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Clone);
                }
                else
                {
                    PyRevitCLICloneCmds.CreateClone(
                        cloneName: TryGetValue("<clone_name>"),
                        deployName: TryGetValue("<deployment_name>"),
                        branchName: TryGetValue("--branch"),
                        repoUrl: TryGetValue("--source"),
                        imagePath: TryGetValue("--image"),
                        destPath: TryGetValue("--dest")
                        );
                }
            }

            else if (all("clones"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Clones);
                }

                else if (all("info"))
                {
                    PyRevitCLICloneCmds.PrintCloneInfo(TryGetValue("<clone_name>"));
                }

                else if (all("open"))
                {
                    PyRevitCLICloneCmds.OpenClone(TryGetValue("<clone_name>"));
                }

                else if (all("add"))
                {
                    PyRevitCLICloneCmds.RegisterClone(
                        TryGetValue("<clone_name>"),
                        TryGetValue("<clone_path>"),
                        force: arguments["--force"].IsTrue
                        );
                }

                else if (all("forget"))
                {
                    PyRevitCLICloneCmds.ForgetClone(
                        allClones: arguments["--all"].IsTrue,
                        cloneName: TryGetValue("<clone_name>")
                        );
                }

                else if (all("rename"))
                {
                    PyRevitCLICloneCmds.RenameClone(
                        cloneName: TryGetValue("<clone_name>"),
                        cloneNewName: TryGetValue("<clone_new_name>")
                        );
                }

                else if (all("delete"))
                {
                    PyRevitCLICloneCmds.DeleteClone(
                        allClones: arguments["--all"].IsTrue,
                        cloneName: TryGetValue("<clone_name>"),
                        clearConfigs: arguments["--clearconfigs"].IsTrue
                        );
                }

                else if (all("branch"))
                {
                    PyRevitCLICloneCmds.GetSetCloneBranch(
                        cloneName: TryGetValue("<clone_name>"),
                        branchName: TryGetValue("<branch_name>")
                        );
                }

                else if (all("version"))
                {
                    PyRevitCLICloneCmds.GetSetCloneTag(
                        cloneName: TryGetValue("<clone_name>"),
                        tagName: TryGetValue("<tag_name>")
                        );
                }

                else if (all("commit"))
                {
                    PyRevitCLICloneCmds.GetSetCloneCommit(
                        cloneName: TryGetValue("<clone_name>"),
                        commitHash: TryGetValue("<commit_hash>")
                        );
                }

                else if (all("origin"))
                {
                    PyRevitCLICloneCmds.GetSetCloneOrigin(
                        cloneName: TryGetValue("<clone_name>"),
                        originUrl: TryGetValue("<origin_url>"),
                        reset: arguments["--reset"].IsTrue
                        );
                }

                else if (all("deployments"))
                {
                    PyRevitCLICloneCmds.PrintCloneDeployments(TryGetValue("<clone_name>"));
                }

                else if (all("engines"))
                {
                    PyRevitCLICloneCmds.PrintCloneEngines(TryGetValue("<clone_name>"));
                }

                else if (all("update"))
                {
                    PyRevitCLICloneCmds.UpdateClone(
                        allClones: arguments["--all"].IsTrue,
                        cloneName: TryGetValue("<clone_name>")
                        );
                }

                else
                {
                    PyRevitCLICloneCmds.PrintClones();
                }
            }

            else if (all("attach"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Attach);
                }
                else
                {
                    PyRevitCLICloneCmds.AttachClone(
                        cloneName: TryGetValue("<clone_name>"),
                        latest: arguments["latest"].IsTrue,
                        dynamoSafe: arguments["dynamosafe"].IsTrue,
                        engineVersion: TryGetValue("<engine_version>"),
                        revitYear: TryGetValue("<revit_year>"),
                        installed: arguments["--installed"].IsTrue,
                        attached: arguments["--attached"].IsTrue,
                        allUsers: arguments["--allusers"].IsTrue
                        );
                }
            }

            else if (all("detach"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Detach);
                }
                else
                {
                    PyRevitCLICloneCmds.DetachClone(
                        revitYear: TryGetValue("<revit_year>"),
                        all: arguments["--all"].IsTrue
                        );
                }
            }

            else if (all("attached"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Attached);
                }
                else
                {
                    PyRevitCLICloneCmds.ListAttachments(revitYear: TryGetValue("<revit_year>"));
                }
            }

            else if (all("switch"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Switch);
                }
                else
                {
                    PyRevitCLICloneCmds.SwitchAttachment(
                        cloneName: TryGetValue("<clone_name>"),
                        revitYear: TryGetValue("<revit_year>")
                        );
                }
            }

            else if (all("extend"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Extend);
                }

                else if (any("ui", "lib", "run"))
                {
                    PyRevitCLIExtensionCmds.Extend(
                        ui: arguments["ui"].IsTrue,
                        lib: arguments["lib"].IsTrue,
                        run: arguments["run"].IsTrue,
                        extName: TryGetValue("<extension_name>"),
                        destPath: TryGetValue("--dest"),
                        repoUrl: TryGetValue("<repo_url>"),
                        branchName: TryGetValue("--branch")
                        );
                }

                else
                {
                    PyRevitCLIExtensionCmds.Extend(
                        extName: TryGetValue("<extension_name>"),
                        destPath: TryGetValue("--dest"),
                        branchName: TryGetValue("--branch")
                        );
                }
            }

            else if (all("extensions"))
            {
                if (all("search"))
                {
                    PyRevitCLIExtensionCmds.PrintExtensionDefinitions(
                        searchPattern: TryGetValue("<search_pattern>"),
                        headerPrefix: "Matched"
                        );
                }

                else if (any("info", "help", "open"))
                {
                    PyRevitCLIExtensionCmds.ProcessExtensionInfoCommands(
                        extName: TryGetValue("<extension_name>"),
                        info: arguments["info"].IsTrue,
                        help: arguments["help"].IsTrue,
                        open: arguments["open"].IsTrue
                        );
                }

                else if (all("delete"))
                {
                    PyRevitCLIExtensionCmds.DeleteExtension(TryGetValue("<extension_name>"));
                }

                else if (all("origin"))
                {
                    PyRevitCLIExtensionCmds.GetSetExtensionOrigin(
                        extName: TryGetValue("<extension_name>"),
                        originUrl: TryGetValue("<origin_url>"),
                        reset: arguments["--reset"].IsTrue
                        );
                }

                else if (all("paths"))
                {
                    if (IsHelpMode)
                    {
                        PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.ExtensionsPaths);
                    }

                    else if (all("add"))
                    {
                        PyRevitCLIExtensionCmds.AddExtensionPath(
                            searchPath: TryGetValue("<extensions_path>")
                            );
                    }

                    else if (all("forget"))
                    {
                        PyRevitCLIExtensionCmds.ForgetAllExtensionPaths(
                            all: arguments["--all"].IsTrue,
                            searchPath: TryGetValue("<extensions_path>")
                            );
                    }

                    else
                    {
                        PyRevitCLIExtensionCmds.PrintExtensionSearchPaths();
                    }
                }

                else if (any("enable", "disable"))
                {
                    PyRevitCLIExtensionCmds.ToggleExtension(
                        enable: arguments["enable"].IsTrue,
                        extName: TryGetValue("<extension_name>")
                        );
                }

                else if (all("sources"))
                {
                    Console.WriteLine("dfsdfsd");
                    if (IsHelpMode)
                    {
                        PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.ExtensionsSources);
                    }

                    else if (all("add"))
                    {
                        PyRevitCLIExtensionCmds.AddExtensionLookupSource(
                            lookupPath: TryGetValue("<source_json_or_url>")
                            );
                    }

                    else if (all("forget"))
                    {
                        PyRevitCLIExtensionCmds.ForgetExtensionLookupSources(
                            all: arguments["--all"].IsTrue,
                            lookupPath: TryGetValue("<source_json_or_url>")
                            );
                    }

                    else
                    {
                        PyRevitCLIExtensionCmds.PrintExtensionLookupSources();
                    }
                }

                else if (all("update"))
                {
                    PyRevitCLIExtensionCmds.UpdateExtension(
                        all: arguments["--all"].IsTrue,
                        extName: TryGetValue("<extension_name>")
                        );
                }

                else if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Extensions);
                }

                else
                {
                    PyRevitCLIExtensionCmds.PrintExtensions();
                }
            }

            else if (all("releases"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Releases);
                }

                else if (all("open"))
                {
                    PyRevitCLIReleaseCmds.OpenReleasePage(
                        searchPattern: TryGetValue("<search_pattern>"),
                        latest: arguments["latest"].IsTrue,
                        listPreReleases: arguments["--pre"].IsTrue
                        );
                }

                else if (all("download"))
                {
                    PyRevitCLIReleaseCmds.DownloadReleaseAsset(
                        arguments["archive"].IsTrue ? PyRevitReleaseAssetType.Archive : PyRevitReleaseAssetType.Installer,
                        destPath: TryGetValue("--dest"),
                        searchPattern: TryGetValue("<search_pattern>"),
                        latest: arguments["latest"].IsTrue,
                        listPreReleases: arguments["--pre"].IsTrue
                        );
                }

                else
                {
                    PyRevitCLIReleaseCmds.PrintReleases(
                        searchPattern: TryGetValue("<search_pattern>"),
                        latest: arguments["latest"].IsTrue,
                        printReleaseNotes: arguments["--notes"].IsTrue,
                        listPreReleases: arguments["--pre"].IsTrue
                        );
                }
            }

            else if (all("image"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Image);
                }
                else
                {
                    PyRevitCLICloneCmds.BuildImage(
                        cloneName: TryGetValue("<clone_name>"),
                        configFile: TryGetValue("--config"),
                        imageFilePath: TryGetValue("--dest")
                        );
                }
            }

            else if (all("revits"))
            {
                if (all("killall"))
                {
                    PyRevitCLIRevitCmds.KillAllRevits(
                        revitYear: TryGetValue("<revit_year>")
                        );
                }

                else if (all("fileinfo"))
                {
                    PyRevitCLIRevitCmds.ProcessFileInfo(
                        targetPath: TryGetValue("<file_or_dir_path>"),
                        outputCSV: TryGetValue("--csv"),
                        IncludeRVT: arguments["--rvt"].IsTrue,
                        includeRTE: arguments["--rte"].IsTrue,
                        includeRFA: arguments["--rfa"].IsTrue,
                        includeRFT: arguments["--rft"].IsTrue
                        );
                }

                else if (all("addons"))
                {
                    if (IsHelpMode)
                    {
                        PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.RevitsAddons);
                    }

                    else if (all("prepare"))
                    {
                        PyRevitCLIRevitCmds.PrepareAddonsDir(
                            revitYear: TryGetValue("<revit_year>"),
                            allUses: arguments["--allusers"].IsTrue
                            );
                    }

                    else if (any("install", "uninstall"))
                    {
                        // TODO: implement revit addon manager
                        logger.Error("Revit addon manager is not implemented yet");
                    }
                }

                else if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Revits);
                }

                else if (arguments["--supported"].IsTrue)
                {
                    PyRevitCLIRevitCmds.ProcessBuildInfo(
                        outputCSV: TryGetValue("--csv")
                        );
                }

                else
                {
                    PyRevitCLIRevitCmds.PrintLocalRevits(running: arguments["--installed"].IsFalse);
                }
            }

            else if (all("run"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Run);
                }
                else
                {
                    PyRevitCLIRevitCmds.RunPythonCommand(
                        inputCommand: TryGetValue("<script_or_command_name>"),
                        targetFile: TryGetValue("<model_file>"),
                        revitYear: TryGetValue("--revit"),
                        runOptions: new PyRevitRunnerOptions()
                    {
                        PurgeTempFiles = arguments["--purge"].IsTrue,
                        ImportPath     = TryGetValue("--import", null)
                    }
                        );
                }
            }

            else if (all("init"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Init);
                }

                else if (any("ui", "lib", "run"))
                {
                    PyRevitCLLInitCmds.InitExtension(
                        ui: arguments["ui"].IsTrue,
                        lib: arguments["lib"].IsTrue,
                        run: arguments["run"].IsTrue,
                        extensionName: TryGetValue("<extension_name>"),
                        templatesDir: TryGetValue("--templates"),
                        useTemplate: arguments["--usetemplate"].IsTrue
                        );
                }

                else if (any("tab", "panel", "panelopt", "pull", "split", "splitpush", "push", "smart", "command"))
                {
                    PyRevitCLLInitCmds.InitBundle(
                        tab: arguments["tab"].IsTrue,
                        panel: arguments["panel"].IsTrue,
                        panelopt: arguments["panelopt"].IsTrue,
                        pull: arguments["pull"].IsTrue,
                        split: arguments["split"].IsTrue,
                        splitpush: arguments["splitpush"].IsTrue,
                        push: arguments["push"].IsTrue,
                        smart: arguments["smart"].IsTrue,
                        command: arguments["command"].IsTrue,
                        bundleName: TryGetValue("<bundle_name>"),
                        templatesDir: TryGetValue("--templates"),
                        useTemplate: arguments["--usetemplate"].IsTrue
                        );
                }
            }

            else if (all("caches"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Caches);
                }

                else if (all("clear"))
                {
                    PyRevitCLIAppCmds.ClearCaches(
                        allCaches: arguments["--all"].IsTrue,
                        revitYear: TryGetValue("<revit_year>")
                        );
                }
            }

            else if (all("config"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Config);
                }
                else
                {
                    PyRevitCLIConfigCmds.SeedConfigs(
                        templateConfigFilePath: TryGetValue("<template_config_path>")
                        );
                }
            }

            else if (all("configs"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Configs);
                }

                else if (all("logs"))
                {
                    Console.WriteLine(string.Format("Logging Level is {0}", PyRevit.GetLoggingLevel().ToString()));
                }

                else if (all("logs", "none"))
                {
                    PyRevit.SetLoggingLevel(PyRevitLogLevels.None);
                }

                else if (all("logs", "verbose"))
                {
                    PyRevit.SetLoggingLevel(PyRevitLogLevels.Verbose);
                }

                else if (all("logs", "debug"))
                {
                    PyRevit.SetLoggingLevel(PyRevitLogLevels.Debug);
                }

                // TODO: Implement allowremotedll
                else if (all("allowremotedll"))
                {
                    throw new NotImplementedException();
                }

                else if (all("checkupdates"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetCheckUpdates(arguments["enable"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("Check Updates is {0}",
                                                        PyRevit.GetCheckUpdates() ? "Enabled" : "Disabled"));
                    }
                }

                else if (all("autoupdate"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetAutoUpdate(arguments["enable"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("Auto Update is {0}",
                                                        PyRevit.GetAutoUpdate() ? "Enabled" : "Disabled"));
                    }
                }

                else if (all("rocketmode"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetRocketMode(arguments["enable"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("Rocket Mode is {0}",
                                                        PyRevit.GetRocketMode() ? "Enabled" : "Disabled"));
                    }
                }

                else if (all("filelogging"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetFileLogging(arguments["enable"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("File Logging is {0}",
                                                        PyRevit.GetFileLogging() ? "Enabled" : "Disabled"));
                    }
                }


                else if (all("loadbeta"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetLoadBetaTools(arguments["enable"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("Load Beta is {0}",
                                                        PyRevit.GetLoadBetaTools() ? "Enabled" : "Disabled"));
                    }
                }

                else if (all("usercanupdate"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetUserCanUpdate(arguments["Yes"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("User {0} update.",
                                                        PyRevit.GetUserCanUpdate() ? "CAN" : "CAN NOT"));
                    }
                }


                else if (all("usercanextend"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetUserCanExtend(arguments["Yes"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("User {0} extend.",
                                                        PyRevit.GetUserCanExtend() ? "CAN" : "CAN NOT"));
                    }
                }


                else if (all("usercanconfig"))
                {
                    if (any("enable", "disable"))
                    {
                        PyRevit.SetUserCanConfig(arguments["Yes"].IsTrue);
                    }
                    else
                    {
                        Console.WriteLine(string.Format("User {0} config.",
                                                        PyRevit.GetUserCanConfig() ? "CAN" : "CAN NOT"));
                    }
                }

                else if (all("usagelogging"))
                {
                    if (all("enable", "file"))
                    {
                        PyRevit.EnableUsageReporting(logFilePath: TryGetValue("<dest_path>"));
                    }

                    else if (all("enable", "server"))
                    {
                        PyRevit.EnableUsageReporting(logServerUrl: TryGetValue("<dest_path>"));
                    }

                    else if (all("disable"))
                    {
                        PyRevit.DisableUsageReporting();
                    }

                    else
                    {
                        Console.WriteLine(string.Format("Usage logging is {0}",
                                                        PyRevit.GetUsageReporting() ? "Enabled" : "Disabled"));
                        Console.WriteLine(string.Format("Log File Path: {0}", PyRevit.GetUsageLogFilePath()));
                        Console.WriteLine(string.Format("Log Server Url: {0}", PyRevit.GetUsageLogServerUrl()));
                    }
                }

                else if (all("outputcss"))
                {
                    if (arguments["<css_path>"] == null)
                    {
                        Console.WriteLine(string.Format("Output Style Sheet is set to: {0}",
                                                        PyRevit.GetOutputStyleSheet()));
                    }
                    else
                    {
                        PyRevit.SetOutputStyleSheet(TryGetValue("<css_path>"));
                    }
                }

                else if (all("seed"))
                {
                    PyRevit.SeedConfig(makeCurrentUserAsOwner: arguments["--lock"].IsTrue);
                }

                else if (all("enable", "disable"))
                {
                    if (arguments["<option_path>"] != null)
                    {
                        // extract section and option names
                        string orignalOptionValue = TryGetValue("<option_path>");
                        if (orignalOptionValue.Split(':').Count() == 2)
                        {
                            string configSection = orignalOptionValue.Split(':')[0];
                            string configOption  = orignalOptionValue.Split(':')[1];

                            PyRevit.SetConfig(configSection, configOption, arguments["enable"].IsTrue);
                        }
                    }
                }

                else
                {
                    if (arguments["<option_path>"] != null)
                    {
                        // extract section and option names
                        string orignalOptionValue = TryGetValue("<option_path>");
                        if (orignalOptionValue.Split(':').Count() == 2)
                        {
                            string configSection = orignalOptionValue.Split(':')[0];
                            string configOption  = orignalOptionValue.Split(':')[1];

                            // if no value provided, read the value
                            if (arguments["<option_value>"] != null)
                            {
                                PyRevit.SetConfig(
                                    configSection,
                                    configOption,
                                    TryGetValue("<option_value>")
                                    );
                            }
                            else if (arguments["<option_value>"] == null)
                            {
                                Console.WriteLine(
                                    string.Format("{0} = {1}",
                                                  configOption,
                                                  PyRevit.GetConfig(configSection, configOption)
                                                  ));
                            }
                        }
                    }
                }
            }

            else if (all("cli"))
            {
                if (IsHelpMode)
                {
                    PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Cli);
                }

                else if (all("addshortcut"))
                {
                    PyRevitCLIAppCmds.AddCLIShortcut(
                        shortcutName: TryGetValue("<shortcut_name>"),
                        shortcutArgs: TryGetValue("<shortcut_args>"),
                        shortcutDesc: TryGetValue("--desc"),
                        allUsers: arguments["--allusers"].IsTrue
                        );
                }

                else if (all("installautocomplete"))
                {
                    PyRevitCLIAppCmds.ActivateAutoComplete();
                }
            }

            else if (IsHelpMode)
            {
                PyRevitCLIAppHelps.PrintHelp(PyRevitCLICommandType.Main);
            }
        }