cake-build / cake-build/cake

Feature Request: CLI Help Improvements

Open
#2,331 2 comments 1 reaction 0 assignees View on GitHub
Feature
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
3h 37m
Merged PRs (30d)
21

Description

When i switched over to using `dotnet-cake`, I lost some of the goodness i had built into my `build.sh` bootstr-wrapper. A few things i had in there were:

* argument aliases/shortcuts (`--environment` == `-e`)
* argument help docs

Some other really useful things this made me think about:
* target-aware required argument validation
* target help docs

I was able to find a rudimentary `dotnet cake --showdescription` to print out a table of tasks/descriptions, so this might be a starting place.

If people agree this would be valuable, i'd happily contribute.

## Stories

I see this as an Epic/Project with a few stories/scopes, so i'll list a couple of them here, in an order which starts with foundation and builds upon previous stories as we go.

### Argument Aliases

I want to be able to optionally define short-aliases for any of my `Argument`s.

Example:
`dotnet cake --environment=AndyTest` can be shortened to `dotnet cake -e AndyTest`

Impl:
```csharp
// Argument(string fullName, string shortName, string defaultValue);
var environment = Argument("environment", "e", "default_environment");
```

### Argument help

The simplest implementation of arg help would be a man-page style dump of all `Argument`s and their descriptions.

```bash
$ dotnet cake --showarguments

All arguments:
-e, --environment name of review environment to deploy to.
-c, --configuration MSBuild configuration to use for build, packaging.
"Debug" or "Release"
```

### Target-aware argument help

A smarter implementation would be able to give help for only arguments that are referenced (directly or transitively) by the Target you're trying to execute.

```bash
$ dotnet cake --target=Deploy --showarguments

Deploy Description:
Deploy a review environment to the kubernetes cluster.

Deploy Arguments:
-e, --environment name of review environment to deploy to.
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing `dotnet cake --showdescription` behavior and the `Argument` usage described in the issue. Break the request into separately testable scopes for aliases, argument help, and target-aware help; done should include the documented command examples working as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.