From b37f7fab934a99d785c76a084b3af11da605e386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 4 Sep 2020 12:25:57 +0300 Subject: [PATCH] Add api-name parameter to the generate-proxy command. --- docs/en/CLI.md | 2 ++ .../Volo/Abp/Cli/Commands/ProxyCommandBase.cs | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index e6e7fcccf8..36f3b8e105 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -191,6 +191,7 @@ abp generate-proxy #### Options * `--module` or `-m`: Specifies the name of the backend module you wish to generate proxies for. Default value: `app`. +* `--api-name` or `-a`: The name of the API endpoint defined in the `/src/environments/environment.ts`. Default value: `default`. * `--source` or `-s`: Specifies the Angular project name to resolve the root namespace & API definition URL from. Default value: `defaultProject`. * `--target` or `-t`: Specifies the Angular project name to place generated code in. Default value: `defaultProject`. * `--prompt` or `-p`: Asks the options from the command line prompt (for the unspecified options). @@ -212,6 +213,7 @@ abp remove-proxy #### Options * `--module` or `-m`: Specifies the name of the backend module you wish to remove proxies for. Default value: `app`. +* `--api-name` or `-a`: The name of the API endpoint defined in the `/src/environments/environment.ts`. Default value: `default`. * `--source` or `-s`: Specifies the Angular project name to resolve the root namespace & API definition URL from. Default value: `defaultProject`. * `--target` or `-t`: Specifies the Angular project name to place generated code in. Default value: `defaultProject`. * `--prompt` or `-p`: Asks the options from the command line prompt (for the unspecified options). diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs index 0116c809cb..7898ae7abc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProxyCommandBase.cs @@ -24,6 +24,7 @@ namespace Volo.Abp.Cli.Commands var defaultValue = prompt ? null : "__default"; var module = commandLineArgs.Options.GetOrNull(Options.Module.Short, Options.Module.Long) ?? defaultValue; + var apiName = commandLineArgs.Options.GetOrNull(Options.ApiName.Short, Options.ApiName.Long) ?? defaultValue; var source = commandLineArgs.Options.GetOrNull(Options.Source.Short, Options.Source.Long) ?? defaultValue; var target = commandLineArgs.Options.GetOrNull(Options.Target.Short, Options.Target.Long) ?? defaultValue; @@ -34,6 +35,11 @@ namespace Volo.Abp.Cli.Commands commandBuilder.Append($" --module {module}"); } + if (apiName != null) + { + commandBuilder.Append($" --api-name {apiName}"); + } + if (source != null) { commandBuilder.Append($" --source {source}"); @@ -100,6 +106,7 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("Options:"); sb.AppendLine(""); sb.AppendLine("-m|--module (default: 'app') The name of the backend module you wish to generate proxies for."); + sb.AppendLine("-a|--api-name (default: 'default') The name of the API endpoint defined in the /src/environments/environment.ts."); sb.AppendLine("-s|--source (default: 'defaultProject') Angular project name to resolve the root namespace & API definition URL from."); sb.AppendLine("-t|--target (default: 'defaultProject') Angular project name to place generated code in."); sb.AppendLine("-p|--prompt Asks the options from the command line prompt (for the missing options)"); @@ -122,6 +129,12 @@ namespace Volo.Abp.Cli.Commands public const string Long = "module"; } + public static class ApiName + { + public const string Short = "a"; + public const string Long = "api-name"; + } + public static class Source { public const string Short = "s";