Skip to content

Commit

Permalink
cli docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidVollmers committed Apr 20, 2024
1 parent fb0803c commit d0d0150
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 7 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Install the `doki` Command-Line Interface:
dotnet tool install --global Doki.CommandLine --version 0.3.0-preview
```

> **Note:** You can find the latest version of the CLI and how to install it
> on [NuGet](https://www.nuget.org/packages/Doki.CommandLine).
Set up your repository:

```bash
Expand All @@ -26,7 +29,9 @@ doki g

## Documentation

Doki is documented using doki. You can find the markdown documentation in the [docs](docs/api/README.md) directory.
Doki is documented using doki. You can find the generated API documentation [here](docs/api/README.md).

You can find the CLI documentation [here](docs/cli/README.md).

---

Expand Down
14 changes: 14 additions & 0 deletions docs/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Doki CLI overview

The `doki` Command-Line Interface (CLI) is a tool that allows you to generate documentation for your .NET projects using
the Doki Documentation Framework.

You can find the latest version of the CLI and how to install it
on [NuGet](https://www.nuget.org/packages/Doki.CommandLine).

## CLI commands

The following commands are available in the `doki` CLI:

- [init](init.md)
- [g](generate.md) (generate)
74 changes: 74 additions & 0 deletions docs/cli/generate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# doki g

## Name

`doki g` - Generate documentation for your .NET projects.

## Synopsis

```bash
doki g [<CONFIG>] [--allow-preview] [-c|--configuration <CONFIGURATION>] [--no-build]

doki g -?|-h|--help
```

## Description

The `doki g` command generates documentation for your .NET projects using the Doki Documentation Framework.

The command will build your project/s and generate documentation based on the configuration in the
`doki.config.json` file.

To set up a configuration file, use the [doki init](init.md) command.

## Arguments

`CONFIG`

The path to the configuration file to use for documentation generation. If not specified, the command will look for a
`doki.config.json` file in the current directory.

## Options

- `--allow-preview`

Allow preview versions of the configured output libraries to be used during documentation generation.


- `-c|--configuration <CONFIGURATION>`

Defines the build configuration for building projects. If not specified, the command will use the `Release`
configuration.


- `--no-build`

Skip building the project/s before generating documentation.
> **Note:** If you use this option, you must ensure that the project/s are built before running the command and that
> the output directories include all project dependencies and their XML documentation files.
## Examples

- Generate documentation:

```bash
doki g
```

- Generate documentation using a specific configuration file:

```bash
doki g path/to/doki.config.json
```

- Generate documentation using a specific build configuration:

```bash
doki g -c Debug
```

- Generate documentation without building the project/s:

```bash
doki g --no-build
```
39 changes: 39 additions & 0 deletions docs/cli/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# doki init

## Name

`doki init` - Set up your repository for documentation generation.

## Synopsis

```bash
doki init

doki init -?|-h|--help
```

## Description

The `doki init` command sets up your repository for documentation generation. It creates a `doki.config.json` file in
the root of your repository that contains the configuration for the documentation generation process.

You can customize the configuration file to suit your needs. The configuration file is used by the [doki g](generate.md)
command to generate documentation.

The `doki init` command will also update or create a `.gitignore` file in the root of your repository to exclude the
`.doki` directory from source control. The `.doki` directory is used for caching during documentation generation
process.

## Options

- `-?|-h|--help`

Show help information for the command.

## Examples

- Set up your repository for documentation generation:

```bash
doki init
```
14 changes: 9 additions & 5 deletions src/Doki.CommandLine/Commands/GenerateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,28 @@ internal partial class GenerateCommand : Command
};

private readonly Argument<FileInfo?> _targetArgument =
new("CONFIG", "The doki.config.json file to use for documentation generation.")
new("CONFIG",
"The path to the configuration file to use for documentation generation. If not specified, the command will look for a `doki.config.json` file in the current directory.")
{
Arity = ArgumentArity.ZeroOrOne
};

private readonly Option<bool> _allowPreviewOption =
new("--allow-preview", "Allow preview versions for NuGet packages.")
new("--allow-preview",
"Allow preview versions of the configured output libraries to be used during documentation generation.")
{
Arity = ArgumentArity.ZeroOrOne
};

private readonly Option<string> _buildConfigurationOption =
new(["-c", "--configuration"], "The build configuration to use when building projects.")
new(["-c", "--configuration"],
"Defines the build configuration for building projects. If not specified, the command will use the \"Release\" configuration.")
{
Arity = ArgumentArity.ZeroOrOne
};

private readonly Option<bool> _noBuildOption =
new("--no-build", "Skip building projects.")
new("--no-build", "Skip building the project/s before generating documentation.")
{
Arity = ArgumentArity.ZeroOrOne
};
Expand All @@ -44,7 +47,8 @@ internal partial class GenerateCommand : Command
private readonly List<string> _builtProjects = [];
private readonly ILogger _logger;

public GenerateCommand(ILogger<GenerateCommand> logger) : base("g", "Generates documentation.")
public GenerateCommand(ILogger<GenerateCommand> logger) : base("g",
"Generate documentation for your .NET projects.")
{
_logger = logger;

Expand Down
2 changes: 1 addition & 1 deletion src/Doki.CommandLine/Commands/InitCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class InitCommand : Command

private readonly ILogger _logger;

public InitCommand(ILogger<InitCommand> logger) : base("init", "Initialize the Doki configuration file.")
public InitCommand(ILogger<InitCommand> logger) : base("init", "Set up your repository for documentation generation.")
{
_logger = logger;

Expand Down

0 comments on commit d0d0150

Please sign in to comment.