Exemplo n.º 1
0
        private static bool CheckStatus(List <string> actionArgs, bool successful)
        {
            string resourceStr;

            if (!(actionArgs.Count == 1 || actionArgs.Count == 2))
            {
                Logger.logError($"add action takes two arguments: alias(optional) ,resource name. Usage:");
                //logUsage();
                return(successful = false);
                // return false;
            }
            else if (actionArgs.Count == 1)
            {
                prefix      = null;
                resourceStr = actionArgs[0];
            }
            else
            {
                prefix      = actionArgs[0];
                resourceStr = actionArgs[1];
            }
            try
            {
                resourceDescription = ResourceIdentifier.generateResourceIdentifier(resourceStr);
            }
            catch (ParseUtils.ArgumentProcessException ex)
            {
                Logger.logError($"Error: {ex.Message}");
                return(successful = false);
            }

            return(successful = true);
        }
Exemplo n.º 2
0
        private static bool CheckStatus(List <string> actionArgs, bool successful)
        {
            if (actionArgs.Count == 1)
            {
                Logger.logError($"dependencies action takes one argument: resource name. Usage:");
                //logUsage();
                successful = false;
                return(successful);
            }

            string resourceStr;

            if (actionArgs.Count > 1)
            {
                resourceStr = actionArgs[1];
                try
                {
                    resourceIdentifier = ResourceIdentifier.generateResourceIdentifier(resourceStr);
                }
                catch (ParseUtils.ArgumentProcessException ex)
                {
                    Logger.logError($"Error: {ex.Message}");
                    successful = false;
                    return(successful);
                }
            }
            successful = true;
            return(successful);
        }
        public static void CheckArguments(List <string> actionArgs, bool successful)
        {
            string resourceStr;

            if (actionArgs.Count <= 1)
            {
                Logger.logError($"publish action takes one required argument, resource name, with an option --deps to add dependencies. Usage:");
                // logUsage();
                successful = false;
                return;
            }
            prefix = "-r";
            //if(actionArgs)
            resourceStr = actionArgs[1];

            try
            {
                resourceIdentifier = ResourceIdentifier.generateResourceIdentifier(resourceStr);
            }
            catch (ParseUtils.ArgumentProcessException ex)
            {
                // Console.WriteLine(ex.Message+"Surbhi");
                Logger.logError($"Error: {ex.Message}");
                successful = false;
                return;
            }

            if (actionArgs.Count > 2)
            {
                string shouldBeDepsOption = actionArgs[1];
                Console.WriteLine(actionArgs[0] + actionArgs[1]);
                Console.WriteLine(shouldBeDepsOption);
                if (shouldBeDepsOption != "--deps")
                {
                    Logger.logError($"Error: publish has one possible option, --deps. Usage:");
                    // logUsage();
                    successful = false;
                    return;
                }

                IEnumerable <string> depStrings = actionArgs.Skip(2);

                foreach (string depString in depStrings)
                {
                    try
                    {
                        deps.Add(ResourceIdentifier.generateResourceIdentifier(depString));
                    }
                    catch (ParseUtils.ArgumentProcessException ex)
                    {
                        Logger.logError($"Error: {ex.Message}");
                        successful = false;
                        return;
                    }
                }
            }

            successful = true;
        }
Exemplo n.º 4
0
        public static int RemovePackage(List <string> actionArgs)
        {
            // Console.WriteLine(actionArgs[0]+ " " + actionArgs[1]);


            string resourceStr = actionArgs[1];

            try
            {
                resourceIdentifier = ResourceIdentifier.generateResourceIdentifier(resourceStr);
            }
            catch (ParseUtils.ArgumentProcessException ex)
            {
                Logger.logError($"Error: {ex.Message}");
                //successful = false;
                //return;
            }

            //successful = true;


            remove(resourceIdentifier);
            return(1);
        }