Skip to content

Commit

Permalink
Update readme with new CLI help
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed May 1, 2024
1 parent a03cf05 commit 30937e6
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 53 deletions.
109 changes: 59 additions & 50 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,86 @@
A dotnet global tool for managing Git credentials using the Microsoft Git Credentials Manager Core.

```
Usage:
gcm [options] [command]
USAGE:
dotnet gcm [OPTIONS] <COMMAND>
Options:
--version Show version information
-?, -h, --help Show help and usage information
OPTIONS:
-h, --help Prints help information
Commands:
get <url> Get a stored credential.
set <url> Store a credential.
delete <url> Delete a stored credential.
COMMANDS:
get Get a stored credential
delete Delete a stored credential
set Store a credential
```

Note that all commands can operate on a simplified syntax using a full URI, which can include `username:password`
(as in the `set` command). That argument is converted to a `Uri` and the existing options are used as the default
value for required options that aren't provided. You can alternatively provide the individual options.


**get**: Get a stored credential.
### dotnet gcm get

```
Usage:
gcm [options] get [<url>]
Arguments:
<url> A URL used to populate options from a single value: [protocol]://[host]/[path?]
Options:
-p, --protocol <protocol> (REQUIRED) The protocol over which the credential will be used (e.g., https).
-h, --host <host> (REQUIRED) The remote hostname for a network credential. This can include the port number.
--path <path> The path with which the credential will be used. E.g., for accessing a remote
https repository, this will be the repository's path on the server.
-?, -h, --help Show help and usage information
DESCRIPTION:
Get a stored credential.
USAGE:
dotnet gcm get [URL] [OPTIONS]
ARGUMENTS:
[URL] A URL used to populate options from a single value: [protocol]://[user]:[password]@[host]/[path?]
OPTIONS:
-h, --help Prints help information
-s, --scheme <SCHEME> The protocol over which the credential will be used (e.g., https)
-h, --host <HOST> The remote hostname for a network credential. This can include the port number
--path <PATH> The path with which the credential will be used. E.g., for accessing a remote https repository, this will be the repository's
path on the server
```

**set**: Store a credential.
### dotnet gcm set

```
Usage:
gcm [options] set [<url>]
Arguments:
<url> A URL used to populate options from a single value: [protocol]://[user]:[password]@[host]/[path?]
Options:
-s, --protocol <protocol> (REQUIRED) The protocol over which the credential will be used (e.g., https).
-h, --host <host> (REQUIRED) The remote hostname for a network credential. This can include the port number.
-u, --username <username> (REQUIRED) The credential's username.
-p, --password <password> (REQUIRED) The credential's password.
--path <path> The path with which the credential will be used. E.g., for accessing a remote https repository, this
will be the repository's path on the server.
-?, -h, --help Show help and usage information
DESCRIPTION:
Store a credential.
USAGE:
dotnet gcm set [URL] [OPTIONS]
ARGUMENTS:
[URL] A URL used to populate options from a single value: [protocol]://[user]:[password]@[host]/[path?]
OPTIONS:
-h, --help Prints help information
-s, --scheme <SCHEME> The protocol over which the credential will be used (e.g., https)
-h, --host <HOST> The remote hostname for a network credential. This can include the port number
--path <PATH> The path with which the credential will be used. E.g., for accessing a remote https repository, this will be the
repository's path on the server
-u, --username <USERNAME> The credential's username
-p, --password <PASSWORD> The credential's password
```

**delete**: Delete a stored credential.
### dotnet gcm delete

```
Usage:
gcm [options] delete [<url>]
Arguments:
<url> A URL used to populate options from a single value: [protocol]://[host]/[path?]
Options:
-p, --protocol <protocol> (REQUIRED) The protocol over which the credential will be used (e.g., https).
-h, --host <host> (REQUIRED) The remote hostname for a network credential. This can include the port number.
--path <path> The path with which the credential will be used. E.g., for accessing a remote https repository, this
will be the repository's path on the server.
-?, -h, --help Show help and usage information
DESCRIPTION:
Delete a stored credential.
USAGE:
dotnet gcm delete [URL] [OPTIONS]
ARGUMENTS:
[URL] A URL used to populate options from a single value: [protocol]://[user]:[password]@[host]/[path?]
OPTIONS:
-h, --help Prints help information
-s, --scheme <SCHEME> The protocol over which the credential will be used (e.g., https)
-h, --host <HOST> The remote hostname for a network credential. This can include the port number
--path <PATH> The path with which the credential will be used. E.g., for accessing a remote https repository, this will be the repository's
path on the server
```

<!-- #content -->
<!-- include https://github.com/devlooped/sponsors/raw/main/footer.md -->
# Sponsors

Expand Down
4 changes: 3 additions & 1 deletion src/DeleteCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Threading.Tasks;
using System.ComponentModel;
using System.Threading.Tasks;
using Spectre.Console.Cli;

namespace Devlooped;

[Description("Delete a stored credential.")]
public class DeleteCommand : AsyncCommand<UrlSettings>
{
public override async Task<int> ExecuteAsync(CommandContext context, UrlSettings settings)
Expand Down
2 changes: 2 additions & 0 deletions src/GetCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using Spectre.Console;
using Spectre.Console.Cli;

namespace Devlooped;

[Description("Get a stored credential.")]
public class GetCommand : AsyncCommand<UrlSettings>
{
public override async Task<int> ExecuteAsync(CommandContext context, UrlSettings settings)
Expand Down
4 changes: 4 additions & 0 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

config.Settings.HelpProviderStyles = new Spectre.Console.Cli.Help.HelpProviderStyle
{
Description = new Spectre.Console.Cli.Help.DescriptionStyle
{
Header = new Spectre.Console.Style(Spectre.Console.Color.Yellow, decoration: Spectre.Console.Decoration.Bold),
},
Usage = new Spectre.Console.Cli.Help.UsageStyle
{
Header = new Spectre.Console.Style(Spectre.Console.Color.Yellow, decoration: Spectre.Console.Decoration.Bold),
Expand Down
4 changes: 3 additions & 1 deletion src/SetCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Threading.Tasks;
using System.ComponentModel;
using System.Threading.Tasks;
using Spectre.Console.Cli;

namespace Devlooped;

[Description("Store a credential.")]
public class SetCommand : AsyncCommand<CredentialUrlSettings>
{
public override async Task<int> ExecuteAsync(CommandContext context, CredentialUrlSettings settings)
Expand Down
3 changes: 2 additions & 1 deletion src/gcm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Spectre.Console.Analyzer" Version="0.49.1" PrivateAssets="all" />
<PackageReference Include="NuGetizer" Version="1.2.1" PrivateAssets="all" />
<PackageReference Include="Spectre.Console.Analyzer" Version="0.49.1" PrivateAssets="all" />
<PackageReference Include="Spectre.Console.Cli" Version="0.49.1" />
<PackageReference Include="git-credential-manager" Version="2.4.1" IncludeAssets="tools" GeneratePathProperty="true" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<!-- include ../readme.md#content -->
<!-- include https://github.com/devlooped/sponsors/raw/main/footer.md -->
<!-- exclude -->

0 comments on commit 30937e6

Please sign in to comment.