コード例 #1
0
        //////////////////////////////////////////////////////////////////////////////

        #region Aliases

        public static void AddAlias(string alias, string commandLine)
        {
            if (alias == null)
            {
                throw new ArgumentNullException("alias");
            }

            if (commandLine == null)
            {
                throw new ArgumentNullException("commandLine");
            }

            CCommand existingCmd = FindCommand(alias);

            if (existingCmd != null)
            {
                CAliasCommand cmd = existingCmd as CAliasCommand;
                if (cmd == null)
                {
                    throw new CCommandException("Can't override command with alias: " + alias);
                }

                cmd.Alias = commandLine;
            }
            else
            {
                Register(new CAliasCommand(alias, commandLine));
            }
        }
コード例 #2
0
        internal static IList <CAliasCommand> ListAliases(IList <CAliasCommand> outList, string prefix = null, CommandListOptions options = CommandListOptions.None)
        {
            foreach (CCommand cmd in m_commands)
            {
                CAliasCommand aliasCmd = cmd as CAliasCommand;
                if (aliasCmd != null && ShouldListCommand(aliasCmd, prefix, options))
                {
                    outList.Add(aliasCmd);
                }
            }

            return(outList);
        }
コード例 #3
0
 private static string ToString(CAliasCommand cmd)
 {
     return string.Format("alias {0} {1}", cmd.Name, StringUtils.Arg(cmd.Alias));
 }
コード例 #4
0
        public static bool RemoveAlias(string name)
        {
            CAliasCommand cmd = FindCommand(name) as CAliasCommand;

            return(cmd != null && Unregister(cmd));
        }
コード例 #5
0
 private static string ToString(CAliasCommand cmd)
 {
     return(string.Format("alias {0} {1}", cmd.Name, StringUtils.Arg(cmd.Alias)));
 }