diff --git a/Il2CppInspector.CLI/PluginOptions.cs b/Il2CppInspector.CLI/PluginOptions.cs index 8694ac9..72f74e2 100644 --- a/Il2CppInspector.CLI/PluginOptions.cs +++ b/Il2CppInspector.CLI/PluginOptions.cs @@ -90,11 +90,22 @@ namespace Il2CppInspector.CLI } var pluginOptionProperty = CreateAutoProperty(pluginOptionClass, option.Name, optionType); - var optCtorInfo = typeof(OptionAttribute).GetConstructor(new Type[] { typeof(string) }); + + ConstructorInfo optCtorInfo; + + // Single character + if (option.Name.Length == 1) + optCtorInfo = typeof(OptionAttribute).GetConstructor(new Type[] { typeof(char) }); + + // Multiple characters + else + optCtorInfo = typeof(OptionAttribute).GetConstructor(new Type[] { typeof(string) }); + var optHelpPropInfo = typeof(OptionAttribute).GetProperty("HelpText"); var optDefaultInfo = typeof(OptionAttribute).GetProperty("Default"); var optRequiredInfo = typeof(OptionAttribute).GetProperty("Required"); - var attBuilder = new CustomAttributeBuilder(optCtorInfo, new object[] { option.Name }, + var attBuilder = new CustomAttributeBuilder(optCtorInfo, + new object[] { option.Name.Length == 1? (object) option.Name[0] : option.Name }, new PropertyInfo[] { optHelpPropInfo, optDefaultInfo, optRequiredInfo }, // Booleans are always optional new object[] { option.Description, optionValue, option.Value is bool? false : option.Required }); diff --git a/Il2CppInspector.Common/Plugins/API/V100/IPluginOption.cs b/Il2CppInspector.Common/Plugins/API/V100/IPluginOption.cs index 2cc9d8c..7a59c4b 100644 --- a/Il2CppInspector.Common/Plugins/API/V100/IPluginOption.cs +++ b/Il2CppInspector.Common/Plugins/API/V100/IPluginOption.cs @@ -65,6 +65,7 @@ namespace Il2CppInspector.PluginAPI.V100 { /// /// The name of the option as it will be supplied in an argument on the command-line + /// If you specify a single character, the single-dash syntax "-x" can be used instead of "--xxxxxx" /// public string Name { get; set; }