pull in help->man command changes (#100)

* Autodetects framework

[Closes #87]

* use the StringTemplate template engine

Replaces the generation of config files using serialization techniques
with the use of a template engine.
Initially the idea was to use Steeltoe.Initializr however StringTemplate
turned out to be a better fit.
[closes #96]

* explicitly fail if oper not done in proper state

[closes #75]

* Update azure-pipelines.yml

* Fix test on Windows

* Disable test

* Revamp of CLI for .0.7.0-rc1 release

[Closes #64] adds 'show' command
[Closes #69] uses docker compoes to deploy app services
[Closes #74] autodetects services

Squashed commit of the following:

commit b77cbb93d2
Merge: c5f8855 ffb6429
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 08:11:23 2020 -0400

    Merge branch 'tack' of github.com:SteeltoeOSS/Tooling into tack

commit c5f8855c6a
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 08:09:22 2020 -0400

    fix url listing

commit 4f3ec442c6
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 08:05:27 2020 -0400

    add services to docker

commit 7da7963ebc
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 07:45:21 2020 -0400

    external nugets and some other rearrangements

commit 3607fd4a5a
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 07:15:14 2020 -0400

    dn not assume a particular profile

commit 90278e0dd6
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 21:55:41 2020 -0400

    add service dependency detection

commit 01e6ab7326
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 20:31:26 2020 -0400

    prep for service dependency support, part 2

commit 091203ade8
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 19:55:47 2020 -0400

    fix console assignment

commit d302207405
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 19:45:57 2020 -0400

    prep for service dependency support

commit b877e7cf96
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 19:22:31 2020 -0400

    assume a default set of services

commit a46277d004
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 17:56:47 2020 -0400

    add netcoreapp2.1

commit 0d981b6aa4
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 17:55:50 2020 -0400

    externalize image registry

commit 3d66fbe385
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 16:27:29 2020 -0400

    guess framework

commit 9fa324a198
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 15:56:16 2020 -0400

    impls stop

commit 0476ea3c78
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 15:51:08 2020 -0400

    impls run

commit 13b22b819f
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 14:41:25 2020 -0400

    prepare for running in docker

commit 93eeb1b43e
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 13:20:20 2020 -0400

    add some safety handling

commit fc5b997c51
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 12:47:37 2020 -0400

    impl show

commit 2e95c94407
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 11:22:33 2020 -0500

    update help help

commit 46511296e5
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 11:19:14 2020 -0500

    rename command show-topic to help

commit a147888d8f
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 11:12:13 2020 -0500

    impl show-topic command

commit 35a913b2a5
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 09:34:43 2020 -0500

    update show-topic help

commit aa9a7c1ad1
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 08:55:09 2020 -0500

    factor out models

commit 2854fa45ed
Author: Chris Cheetham <chris@cheetham.com>
Date:   Sun Feb 16 12:17:32 2020 -0500

    tidy

commit 9f2789bf64
Author: Chris Cheetham <chris@cheetham.com>
Date:   Sat Feb 15 12:30:19 2020 -0500

    stub new commands

commit ffb6429a02
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 08:09:22 2020 -0400

    fix url listing

commit a61d87a613
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 08:05:27 2020 -0400

    add services to docker

commit d41e137f01
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 07:45:21 2020 -0400

    external nugets and some other rearrangements

commit 430841be02
Author: Chris Cheetham <chris@cheetham.com>
Date:   Thu Mar 26 07:15:14 2020 -0400

    dn not assume a particular profile

commit 90df4ff676
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 21:55:41 2020 -0400

    add service dependency detection

commit d874e0fa22
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 20:31:26 2020 -0400

    prep for service dependency support, part 2

commit 0df0cf2f18
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 19:55:47 2020 -0400

    fix console assignment

commit 84bd775056
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 19:45:57 2020 -0400

    prep for service dependency support

commit 1170f4837d
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 19:22:31 2020 -0400

    assume a default set of services

commit aabf7dba8f
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 17:56:47 2020 -0400

    add netcoreapp2.1

commit 19d5d4745e
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 17:55:50 2020 -0400

    externalize image registry

commit bd7755410b
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 16:27:29 2020 -0400

    guess framework

commit 33ab8d9db7
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 15:56:16 2020 -0400

    impls stop

commit 7188a75bdb
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 15:51:08 2020 -0400

    impls run

commit ab75cdf8d5
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 14:41:25 2020 -0400

    prepare for running in docker

commit 5db35fdf00
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 13:20:20 2020 -0400

    add some safety handling

commit 80d3c7dd69
Author: Chris Cheetham <chris@cheetham.com>
Date:   Wed Mar 25 12:47:37 2020 -0400

    impl show

commit 454217e4aa
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 11:22:33 2020 -0500

    update help help

commit eda4ca38ee
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 11:19:14 2020 -0500

    rename command show-topic to help

commit 178d8b60ae
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 11:12:13 2020 -0500

    impl show-topic command

commit 83c66d1b90
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 09:34:43 2020 -0500

    update show-topic help

commit 9ae1542a3d
Author: Chris Cheetham <chris@cheetham.com>
Date:   Mon Feb 17 08:55:09 2020 -0500

    factor out models

commit 246f7b672e
Author: Chris Cheetham <chris@cheetham.com>
Date:   Sun Feb 16 12:17:32 2020 -0500

    tidy

commit f9fa4cd902
Author: Chris Cheetham <chris@cheetham.com>
Date:   Sat Feb 15 12:30:19 2020 -0500

    stub new commands

* Tidy

* Bump version to 0.7.0

* Allow test to pass regardless of framework

* Explicitly set framework version

* Install DotNet 3.1

* Fix pipeline indentation

* Add netcoreapp2.1 and netcoreapp3.1 support

* Install DotNet 2.1

* Doc updates

* Tidy docs

* Update README.adoc

Adding note to assist with any path issues.

* Update src/Steeltoe.Tooling/steeltoe.rc/registry/dependencies.yml

Co-authored-by: Tim Hess <thess@pivotal.io>

* Rename "help" command to "man"

* Add headings to topic list

* No longer part of repo

* Tidy white space

* Fix branch

* Fix CI trigger for dev

* Fix backwords merge

* Restore master settings

Co-authored-by: Tim Hess <thess@pivotal.io>
Co-authored-by: Jason Konicki <jkonicki@users.noreply.github.com>
This commit is contained in:
Chris Cheetham 2020-05-26 12:32:24 -04:00 коммит произвёл GitHub
Родитель 4b16cc1a16
Коммит f66daa55b1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 27 добавлений и 25 удалений

Просмотреть файл

@ -29,8 +29,8 @@ $ dotnet tool install -g Steeltoe.Cli --version 0.7.0-1904 --add-source https://
You can invoke the tool using the following command: st
Tool 'steeltoe.cli' (version '0.7.0-1904') was successfully installed.
# NOTE: The dotnet tool option requires adding the tools path to the PATH variable in your environment.
# This must be done before the next step.
# NOTE: The dotnet tool option requires adding the tools path to the PATH variable in your environment.
# This must be done before the next step.
$ st --version
0.7.0 (build 1904 -> https://dev.azure.com/SteeltoeOSS/Steeltoe/_build/results?buildId=1904)

Просмотреть файл

@ -1,7 +1,7 @@
trigger:
- master
- dev
- refs/tags/*
- dev
variables:
Solution: 'Tooling'

Просмотреть файл

@ -34,14 +34,14 @@ Examples:
Display documentation for autodetection:
$ st help autodetection"
)]
public class HelpCommand : Command
public class ManCommand : Command
{
public const string CommandName = "help";
public const string CommandName = "man";
[Argument(0, Name = "topic", Description = "Topic")]
private string Topic { get; } = null;
public HelpCommand(IConsole console) : base(console)
public ManCommand(IConsole console) : base(console)
{
}
@ -86,6 +86,7 @@ Examples:
var maxTopicLength = topicPaths.Select(Path.GetFileNameWithoutExtension)
.Select(topic => topic.Length).Concat(new[] {0}).Max();
var descriptionColumn = maxTopicLength + 4;
Context.Console.WriteLine("Topic".PadRight(descriptionColumn) + "Description");
foreach (var topicPath in topicPaths)
{
var topic = Path.GetFileNameWithoutExtension(topicPath);

Просмотреть файл

@ -20,7 +20,7 @@ namespace Steeltoe.Cli
{
[Command(Name = Name, Description = "Steeltoe Developer Tools")]
[VersionOptionFromMember("-V|--version", MemberName = nameof(GetVersion))]
[Subcommand(HelpCommand.CommandName, typeof(HelpCommand))]
[Subcommand(ManCommand.CommandName, typeof(ManCommand))]
[Subcommand(RunCommand.CommandName, typeof(RunCommand))]
[Subcommand(ShowCommand.CommandName, typeof(ShowCommand))]
[Subcommand(StopCommand.CommandName, typeof(StopCommand))]

Просмотреть файл

@ -17,19 +17,19 @@ using LightBDD.XUnit2;
namespace Steeltoe.Cli.Test
{
public class HelpFeature : FeatureSpecs
public class ManFeature : FeatureSpecs
{
[Scenario]
public void HelpHelp()
public void ManHelp()
{
Runner.RunScenario(
given => an_empty_directory("help_help"),
when => the_developer_runs_cli_command("help --help"),
given => an_empty_directory("man_help"),
when => the_developer_runs_cli_command("man --help"),
then => the_cli_command_should_succeed(),
and => the_cli_should_output(new[]
{
"Displays documentation on a topic",
$"Usage: {Program.Name} help [arguments] [options]",
$"Usage: {Program.Name} man [arguments] [options]",
"Arguments:",
"topic Topic",
"Options:",
@ -46,45 +46,46 @@ namespace Steeltoe.Cli.Test
}
[Scenario]
public void HelpTooManyArgs()
public void ManTooManyArgs()
{
Runner.RunScenario(
given => an_empty_directory("help_too_many_args"),
when => the_developer_runs_cli_command("help arg1 arg2"),
given => an_empty_directory("man_too_many_args"),
when => the_developer_runs_cli_command("man arg1 arg2"),
then => the_cli_should_fail_parse("Unrecognized command or argument 'arg2'")
);
}
[Scenario]
public void HelpTopicList()
public void ManTopicList()
{
Runner.RunScenario(
given => an_empty_directory("help_topic_list"),
when => the_developer_runs_cli_command("help"),
given => an_empty_directory("man_topic_list"),
when => the_developer_runs_cli_command("man"),
then => the_cli_command_should_succeed(),
and => the_cli_should_output(new[]
{
"Topic Description",
"autodetection Application and Service Autodetection",
})
);
}
[Scenario]
public void HelpNotFound()
public void ManTopicNotFound()
{
Runner.RunScenario(
given => an_empty_directory("help_topic_not_found"),
when => the_developer_runs_cli_command("help no-such-topic"),
given => an_empty_directory("man_topic_not_found"),
when => the_developer_runs_cli_command("man no-such-topic"),
then => the_cli_should_error(ErrorCode.Tooling, "Topic does not exist: no-such-topic")
);
}
[Scenario]
public void HelpAutodetection()
public void ManAutodetection()
{
Runner.RunScenario(
given => an_empty_directory("help_topic_autodetection"),
when => the_developer_runs_cli_command("help autodetection"),
given => an_empty_directory("man_topic_autodetection"),
when => the_developer_runs_cli_command("man autodetection"),
then => the_cli_command_should_succeed(),
and => the_cli_should_output(new[]
{

Просмотреть файл

@ -48,7 +48,7 @@ namespace Steeltoe.Cli.Test
"-D|--debug Enable debug output",
"-?|-h|--help Show help information",
"Commands:",
"help Displays documentation on a topic",
"man Displays documentation on a topic",
"run Runs project in the local Docker environment",
"show Displays project details",
"stop Stops project running in the local Docker environment",