Skip to content

Commit

Permalink
New command to delete app.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed May 10, 2022
1 parent e1f0b85 commit f1a8785
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cli/Squidex.CLI/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Squidex/squidex/</PackageProjectUrl>
<PackageTags>Squidex HeadlessCMS</PackageTags>
<Version>8.12</Version>
<Version>8.13</Version>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public SyncService(IFileSystem fileSystem, ISession session)

schema.AdditionalPropertiesSchema = new JsonSchema
{
Description = "Any"
Description = "Any."
};
}));

Expand Down
34 changes: 33 additions & 1 deletion cli/Squidex.CLI/Squidex.CLI/Commands/App_Apps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,31 @@ public async Task Create(CreateArguments arguments)
log.WriteLine("> App created.");
}

[Command("delete", Description = "Delete the app.")]
public async Task Delete(DeleteArguments arguments)
{
var session = configuration.StartSession(arguments.App);

var name = arguments.App;

if (string.IsNullOrWhiteSpace(name))
{
name = session.App;
}

if (!string.Equals(name, arguments.Confirm, StringComparison.Ordinal))
{
throw new CLIException("Confirmed app name does not match.");
}

await session.Apps.DeleteAppAsync(name);

log.WriteLine("> App deleted.");
}

public sealed class ListArguments : AppArguments
{
[Option('t', "table", Description = "Output as table")]
[Option('t', "table", Description = "Output as table.")]
public bool Table { get; set; }

public sealed class Validator : AbstractValidator<ListArguments>
Expand All @@ -92,6 +114,16 @@ public sealed class Validator : AbstractValidator<CreateArguments>
{
}
}

public sealed class DeleteArguments : AppArguments
{
[Option("confirm", Description = "Confirm the name of the app.")]
public string Confirm { get; set; }

public sealed class Validator : AbstractValidator<DeleteArguments>
{
}
}
}
}
}
2 changes: 1 addition & 1 deletion cli/Squidex.CLI/Squidex.CLI/Commands/App_Backup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public sealed class CreateArguments : AppArguments
[Option("timeout", Description = "The timeout to wait for the backup in minutes.")]
public int Timeout { get; set; } = 30;

[Option("deleteAfterDownload", Description = "Defines if the created backup shall be deleted from app after the backup task is completed")]
[Option("deleteAfterDownload", Description = "Defines if the created backup shall be deleted from app after the backup task is completed.")]
public bool DeleteAfterDownload { get; set; }

public sealed class Validator : AbstractValidator<CreateArguments>
Expand Down
2 changes: 1 addition & 1 deletion cli/Squidex.CLI/Squidex.CLI/Commands/App_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void Reset()

public sealed class ListArguments : IArgumentModel
{
[Option('t', "table", Description = "Output as table")]
[Option('t', "table", Description = "Output as table.")]
public bool Table { get; set; }

public sealed class Validator : AbstractValidator<ListArguments>
Expand Down
2 changes: 1 addition & 1 deletion cli/Squidex.CLI/Squidex.CLI/Commands/App_Schemas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public async Task Sync(SyncArguments arguments)

public sealed class ListArguments : AppArguments
{
[Option('t', "table", Description = "Output as table")]
[Option('t', "table", Description = "Output as table.")]
public bool Table { get; set; }

public sealed class Validator : AbstractValidator<ListArguments>
Expand Down
6 changes: 3 additions & 3 deletions cli/Squidex.CLI/Squidex.CLI/Commands/App_Sync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task New(NewArgument arguments)
log.WriteLine("> Folder generated.");
}

[Command("out", Description = "Exports the app to a folder")]
[Command("out", Description = "Exports the app to a folder.")]
public async Task Out(OutArguments arguments)
{
var session = configuration.StartSession(arguments.App);
Expand All @@ -57,7 +57,7 @@ public async Task Out(OutArguments arguments)
log.WriteLine("> Synchronization completed.");
}

[Command("in", Description = "Imports the app from a folder")]
[Command("in", Description = "Imports the app from a folder.")]
public async Task In(InArguments arguments)
{
var session = configuration.StartSession(arguments.App, arguments.Emulate);
Expand All @@ -77,7 +77,7 @@ public async Task Describe(DescribeArguments arguments)
log.WriteLine("> Describing completed.");
}

[Command("targets", Description = "List all targets")]
[Command("targets", Description = "List all targets.")]
public void Targets()
{
foreach (var target in synchronizer.GetTargets())
Expand Down

0 comments on commit f1a8785

Please sign in to comment.