/// <summary>
        /// Safely parses a string cmdlet name into a <see cref="CmdletName"/> object.
        /// </summary>
        /// <param name="stringCmdletName">The string cmdlet name to parse</param>
        /// <param name="parsedName">The CmdletName object</param>
        /// <returns>True if the string cmdlet name could be parsed, otherwise false.</returns>
        public static bool TryParse(string stringCmdletName, out CmdletName parsedName)
        {
            if (!string.IsNullOrWhiteSpace(stringCmdletName))
            {
                string[] splitString = stringCmdletName.Split('-');
                if (splitString.Length == 2)
                {
                    string verb = splitString[0];
                    string noun = splitString[1];

                    if (!string.IsNullOrWhiteSpace(verb) && !string.IsNullOrWhiteSpace(noun))
                    {
                        parsedName = new CmdletName(verb, noun);
                        return(true);
                    }
                }
            }

            parsedName = null;
            return(false);
        }
 /// <summary>
 /// Creates a new representation of a Graph SDK cmdlet.
 /// </summary>
 /// <param name="cmdletName">The name of the cmdlet</param>
 public Cmdlet(CmdletName cmdletName)
 {
     this.Name = cmdletName ?? throw new ArgumentNullException(nameof(cmdletName));
 }
Exemplo n.º 3
0
 public OperationCmdlet(CmdletName cmdletName) : base(cmdletName)
 {
 }