Skip to content

Commit

Permalink
Rename shell to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
calebkiage committed Aug 8, 2023
1 parent 6f49e56 commit 0812ebe
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The following table provides an overview of the languages supported by Kiota and
| PHP || [](https://github.com/microsoft/kiota-abstractions-php) | [JSON](https://github.com/microsoft/kiota-serialization-json-php), [❌ FORM](https://github.com/microsoft/kiota/issues/2074), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3029), [TEXT](https://github.com/microsoft/kiota-serialization-text-php) | [Anonymous](https://github.com/microsoft/kiota-abstractions-php/blob/main/src/Authentication/AnonymousAuthenticationProvider.php), [✔️ PHP League](https://github.com/microsoft/kiota-authentication-phpleague-php) | [](https://github.com/microsoft/kiota-http-guzzle-php) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/php) |
| Python || [](https://github.com/microsoft/kiota-abstractions-python) | [❌ FORM](https://github.com/microsoft/kiota/issues/2075), [JSON](https://github.com/microsoft/kiota-serialization-json-python), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3030), [TEXT](https://github.com/microsoft/kiota-serialization-text-python) | [Anonymous](https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/authentication/anonymous_authentication_provider.py), [Azure](https://github.com/microsoft/kiota-authentication-azure-python) | [](https://github.com/microsoft/kiota-http-python) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/python) |
| Ruby || [](https://github.com/microsoft/kiota-abstractions-ruby) | [❌ FORM](https://github.com/microsoft/kiota/issues/2077), [JSON](https://github.com/microsoft/kiota-serialization-json-ruby), [❌ MULTIPART](https://github.com/microsoft/kiota/issues/3032), [❌ TEXT](https://github.com/microsoft/kiota/issues/1049) | [Anonymous](https://github.com/microsoft/kiota-abstractions-ruby/blob/main/lib/microsoft_kiota_abstractions/authentication/anonymous_authentication_provider.rb), [✔️ OAuth2](https://github.com/microsoft/kiota-authentication-oauth-ruby) | [](https://github.com/microsoft/kiota-http-ruby)| [link](https://learn.microsoft.com/openapi/kiota/quickstarts/ruby) |
| Shell || (see CSHarp) + [](https://github.com/microsoft/kiota-cli-commons) | (see CSHarp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) |
| Shell || (see CSharp) + [](https://github.com/microsoft/kiota-cli-commons) | (see CSharp) | (see CSharp) | (see CSharp) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/cli) |
| Swift | [](https://github.com/microsoft/kiota/issues/1449) | [](./abstractions/swift) | [❌ FORM](https://github.com/microsoft/kiota/issues/2076), [❌ JSON](https://github.com/microsoft/kiota/issues/1451), [❌ FORM](https://github.com/microsoft/kiota/issues/3033), [❌ TEXT](https://github.com/microsoft/kiota/issues/1452) | [Anonymous](./abstractions/swift/Source/MicrosoftKiotaAbstractions/Authentication/AnonymousAuthenticationProvider.swift), [❌ Azure](https://github.com/microsoft/kiota/issues/1453) | [](https://github.com/microsoft/kiota/issues/1454)| |
| TypeScript/JavaScript | ✔ | [✔](https://github.com/microsoft/kiota-typescript/tree/main/packages/abstractions) | [FORM](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/form), [JSON](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/json), [MULTIPART](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/multipart), [TEXT](https://github.com/microsoft/kiota-typescript/tree/main/packages/serialization/text) | [Anonymous](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/authentication/anonymousAuthenticationProvider.ts), [API Key](https://github.com/microsoft/kiota-typescript/blob/main/packages/abstractions/src/authentication/apiKeyAuthenticationProvider.ts), [Azure](https://github.com/microsoft/kiota-typescript/tree/main/packages/authentication/azure) | [✔](https://github.com/microsoft/kiota-typescript/tree/main/packages/http/fetch) | [link](https://learn.microsoft.com/openapi/kiota/quickstarts/typescript) |

Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/CodeDOM/CodeMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public PagingInformation? PagingInformation

/// <summary>
/// The combination of the path, query and header parameters for the current URL.
/// Only use this property if the language you are generating for doesn't support fluent API style (e.g. Shell/CLI)
/// Only use this property if the language you are generating for doesn't support fluent API style (e.g. CLI)
/// </summary>
public IEnumerable<CodeParameter> PathQueryAndHeaderParameters
{
Expand Down
26 changes: 13 additions & 13 deletions src/Kiota.Builder/GenerationLanguage.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
namespace Kiota.Builder;
public enum GenerationLanguage
{
CSharp,
Java,
TypeScript,
PHP,
Python,
Go,
Swift,
Ruby,
Shell
}
namespace Kiota.Builder;
public enum GenerationLanguage
{
CSharp,
Java,
TypeScript,
PHP,
Python,
Go,
Swift,
Ruby,
CLI
}
2 changes: 1 addition & 1 deletion src/Kiota.Builder/KiotaBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ private void CreateOperationMethods(OpenApiUrlTreeNode currentNode, OperationTyp
var mediaType = operation.Responses.Values.SelectMany(static x => x.Content).First(x => x.Value.Schema == schema).Key;
generatorMethod.AcceptedResponseTypes.Add(mediaType);
}
if (config.Language == GenerationLanguage.Shell)
if (config.Language == GenerationLanguage.CLI)
SetPathAndQueryParameters(generatorMethod, currentNode, operation);
AddRequestBuilderMethodParameters(currentNode, operationType, operation, requestConfigClass, generatorMethod);
parentClass.AddMethod(generatorMethod);
Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Refiners/ILanguageRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static async Task Refine(GenerationConfiguration config, CodeNamespace ge
case GenerationLanguage.Go:
await new GoRefiner(config).Refine(generatedCode, cancellationToken).ConfigureAwait(false);
break;
case GenerationLanguage.Shell:
case GenerationLanguage.CLI:
await new ShellRefiner(config).Refine(generatedCode, cancellationToken).ConfigureAwait(false);
break;
case GenerationLanguage.Swift:
Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/Writers/LanguageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public static LanguageWriter GetLanguageWriter(GenerationLanguage language, stri
GenerationLanguage.PHP => new PhpWriter(outputPath, clientNamespaceName, usesBackingStore),
GenerationLanguage.Python => new PythonWriter(outputPath, clientNamespaceName, usesBackingStore),
GenerationLanguage.Go => new GoWriter(outputPath, clientNamespaceName),
GenerationLanguage.Shell => new ShellWriter(outputPath, clientNamespaceName),
GenerationLanguage.CLI => new ShellWriter(outputPath, clientNamespaceName),
GenerationLanguage.Swift => new SwiftWriter(outputPath, clientNamespaceName),
_ => throw new InvalidEnumArgumentException($"{language} language currently not supported."),
};
Expand Down
4 changes: 2 additions & 2 deletions tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ public void Supports_Path_Query_And_Header_Parameters()
}
};
var mockLogger = new Mock<ILogger<KiotaBuilder>>();
var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.Shell }, _httpClient);
var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.CLI }, _httpClient);
var node = builder.CreateUriSpace(document);
var codeModel = builder.CreateSourceModel(node);
var deviceManagementNS = codeModel.FindNamespaceByName("ApiSdk.deviceManagement");
Expand Down Expand Up @@ -1331,7 +1331,7 @@ public void DeduplicatesConflictingParameterNamesForCLI()
},
};
var mockLogger = new Mock<ILogger<KiotaBuilder>>();
var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.Shell }, _httpClient);
var builder = new KiotaBuilder(mockLogger.Object, new GenerationConfiguration { ClientClassName = "Graph", ApiRootUrl = "https://localhost", Language = GenerationLanguage.CLI }, _httpClient);
var node = builder.CreateUriSpace(document);
var codeModel = builder.CreateSourceModel(node);
var resultsNS = codeModel.FindNamespaceByName("ApiSdk.test.item.results");
Expand Down
8 changes: 4 additions & 4 deletions tests/Kiota.Builder.Tests/Refiners/ShellRefinerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task AddsUsingsForCommandTypesUsedInCommandBuilder()
IsExternal = true
}
}).First();
await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root);
await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root);

var declaration = requestBuilder.StartBlock;

Expand Down Expand Up @@ -166,7 +166,7 @@ public async Task CreatesCommandBuilders()
SerializerModules = new() { "com.microsoft.kiota.serialization.Serializer" }
});

await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root);
await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root);

var methods = root.GetChildElements().OfType<CodeClass>().SelectMany(c => c.Methods);
var methodNames = methods.Select(m => m.Name);
Expand Down Expand Up @@ -239,7 +239,7 @@ public async Task RemovesRequestAdaptersFromCodeDom()
Assert.Contains("adapter", propertyNames);
Assert.Contains("adapter", methodParamNames);

await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root);
await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root);

Assert.DoesNotContain("adapter", propertyNames);
Assert.DoesNotContain("adapter", methodParamNames);
Expand Down Expand Up @@ -285,7 +285,7 @@ public async Task RenamesNavPropertiesInIndexersWithConflicts()
};
rootRequestBuilder.AddIndexer(indexer);

await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.Shell }, root);
await ILanguageRefiner.Refine(new GenerationConfiguration { Language = GenerationLanguage.CLI }, root);

Assert.Equal("GraphOrgContactNav-ById", idxNavProp.Name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ShellCodeMethodWriterTests : IDisposable

public ShellCodeMethodWriterTests()
{
writer = LanguageWriter.GetLanguageWriter(GenerationLanguage.Shell, DefaultPath, DefaultName);
writer = LanguageWriter.GetLanguageWriter(GenerationLanguage.CLI, DefaultPath, DefaultName);
tw = new StringWriter();
writer.SetTextWriter(tw);
root = CodeNamespace.InitRootNamespace();
Expand Down
12 changes: 6 additions & 6 deletions vscode/microsoft-kiota/src/kiotaInterop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export enum KiotaGenerationLanguage {
// eslint-disable-next-line @typescript-eslint/naming-convention
Ruby = 7,
// eslint-disable-next-line @typescript-eslint/naming-convention
Shell = 8,
CLI = 8,
}
export function generationLanguageToString(language: KiotaGenerationLanguage): string {
switch (language) {
Expand All @@ -106,8 +106,8 @@ export function generationLanguageToString(language: KiotaGenerationLanguage): s
return "Swift";
case KiotaGenerationLanguage.Ruby:
return "Ruby";
case KiotaGenerationLanguage.Shell:
return "Shell";
case KiotaGenerationLanguage.CLI:
return "CLI";
default:
throw new Error("unknown language");
}
Expand All @@ -130,8 +130,8 @@ export function parseGenerationLanguage(value: string): KiotaGenerationLanguage
return KiotaGenerationLanguage.Swift;
case "Ruby":
return KiotaGenerationLanguage.Ruby;
case "Shell":
return KiotaGenerationLanguage.Shell;
case "CLI":
return KiotaGenerationLanguage.CLI;
default:
throw new Error("unknown language");
}
Expand All @@ -143,7 +143,7 @@ export const allGenerationLanguages = [
KiotaGenerationLanguage.PHP,
KiotaGenerationLanguage.Python,
KiotaGenerationLanguage.Ruby,
KiotaGenerationLanguage.Shell,
KiotaGenerationLanguage.CLI,
KiotaGenerationLanguage.Swift,
KiotaGenerationLanguage.TypeScript,
];
Expand Down

0 comments on commit 0812ebe

Please sign in to comment.