Skip to content

Commit fa1f777

Browse files
authored
Corrected apps delete function. (#90)
* Corrected "schemas" to "indexes" under App_Indexes. * Corrected typo "schemas" to "apps" under App_Apps * Fixed the issue of possibility of deleting wrong app. * Removed unused name declaration. * Added fallback name for apps delete. * Update App_Apps.cs * Updated app description to better describe its usage.
1 parent 7b4bb07 commit fa1f777

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cli/Squidex.CLI/Squidex.CLI/Commands/App.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void Info()
2222

2323
public abstract class AppArguments : IArgumentModel
2424
{
25-
[Option("app", Description = "The name of the app. If not provided then app configured in currentApp gets created.")]
25+
[Option("app", Description = "The name of the app. If not provided then app configured in currentApp gets used.")]
2626
public string App { get; set; }
2727
}
2828
}

cli/Squidex.CLI/Squidex.CLI/Commands/App_Apps.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ public async Task Delete(DeleteArguments arguments)
7373
{
7474
var session = configuration.StartSession(arguments.App);
7575

76-
var name = arguments.App;
76+
var name = session.App;
7777

78-
if (string.IsNullOrWhiteSpace(name))
78+
if (!string.IsNullOrWhiteSpace(arguments.App) && !string.Equals(name, arguments.App, StringComparison.Ordinal))
7979
{
80-
name = session.App;
80+
log.WriteLine($"Provided app name does not match with the session app name {name}. We will fallback to use this as app name: {name}.");
8181
}
8282

8383
if (!string.Equals(name, arguments.Confirm, StringComparison.Ordinal))
8484
{
85-
throw new CLIException("Confirmed app name does not match.");
85+
throw new CLIException($"Confirmed app name does not match with the session app name: {name}.");
8686
}
8787

8888
await session.Client.Apps.DeleteAppAsync();

0 commit comments

Comments
 (0)