From 9fa324a19852b384f388910b03d0e64cf72e32b4 Mon Sep 17 00:00:00 2001 From: Chris Cheetham Date: Wed, 25 Mar 2020 15:56:16 -0400 Subject: [PATCH] impls stop --- src/Steeltoe.Cli/CommandShell.cs | 1 - src/Steeltoe.Cli/StopCommand.cs | 2 +- src/Steeltoe.Tooling/Cli.cs | 1 - .../Controllers/StopController.cs | 32 +++++++++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/Steeltoe.Tooling/Controllers/StopController.cs diff --git a/src/Steeltoe.Cli/CommandShell.cs b/src/Steeltoe.Cli/CommandShell.cs index 592a12f..5561cce 100644 --- a/src/Steeltoe.Cli/CommandShell.cs +++ b/src/Steeltoe.Cli/CommandShell.cs @@ -87,7 +87,6 @@ namespace Steeltoe.Cli private static void OutputToConsole(string output) { - if (!Settings.VerboseEnabled) return; var oldFg = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Out.WriteLine(output); diff --git a/src/Steeltoe.Cli/StopCommand.cs b/src/Steeltoe.Cli/StopCommand.cs index 22e7ba0..8f70f02 100644 --- a/src/Steeltoe.Cli/StopCommand.cs +++ b/src/Steeltoe.Cli/StopCommand.cs @@ -39,7 +39,7 @@ See Also: protected override Controller GetController() { - throw new NotImplementedException(); + return new StopController(); } } } diff --git a/src/Steeltoe.Tooling/Cli.cs b/src/Steeltoe.Tooling/Cli.cs index 50876d3..e4f3b07 100644 --- a/src/Steeltoe.Tooling/Cli.cs +++ b/src/Steeltoe.Tooling/Cli.cs @@ -63,7 +63,6 @@ namespace Steeltoe.Tooling private static void OutputToConsole(string output) { - if (!Settings.VerboseEnabled) return; var oldFg = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Blue; Console.Out.WriteLine(output); diff --git a/src/Steeltoe.Tooling/Controllers/StopController.cs b/src/Steeltoe.Tooling/Controllers/StopController.cs new file mode 100644 index 0000000..a71afe1 --- /dev/null +++ b/src/Steeltoe.Tooling/Controllers/StopController.cs @@ -0,0 +1,32 @@ +// Copyright 2020 the original author or authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace Steeltoe.Tooling.Controllers +{ + /// + /// Controls the "stop" operation. + /// + public class StopController : Controller + { + /// + /// Stops the project in the local Docker environment. + /// + protected override void Execute() + { + var project = GetProject(); + var cli = new Cli("docker-compose", Context.Shell); + cli.Run("down", $"stopping '{project.Name}' in Docker"); + } + } +}