public static IValue Function(IExecutionContext ctx, IList<IArgument> arguments) { var args = CommandUtilities.ManageArguments(arguments) .AtLeast(2) .CanConvert<string>(0) .CanConvert<IExecutable>(1) .CanConvert<string>(2, arguments.Count - 1) .Results(); IExecutable executable = args[1].GetValue<IExecutable>(); List<string> argNames = new List<string>(); for (int i = 2; i < args.Length; i++) { argNames.Add(args[i].GetValue<string>()); } ctx.RegisterCommand(args[0].GetValue<string>(), CreateCommand(executable, argNames)); return new GenericValue<bool>(true); }