﻿---
title: Console app quick start
description: The simplest way to use Nullean.Argh - no dependencies, no host, just a CLI. All three registration forms are supported: Use MapRoot to define a handler...
url: https://docs-v3-preview.elastic.dev/argh/getting-started/console-app
---

# Console app quick start
The simplest way to use Nullean.Argh - no dependencies, no host, just a CLI.
<stepper>
  <step title="Add the package reference">
    ```xml
    <ItemGroup>
      <PackageReference Include="Nullean.Argh" />
    </ItemGroup>
    ```
  </step>

  <step title="Create a minimal CLI">
    ```csharp
    using Nullean.Argh;

    var app = new ArghApp();
    app.Map("hello", MyHandlers.SayHello);

    return await app.RunAsync(args);
    ```
  </step>

  <step title="Run it">
    ```shell
    dotnet run -- hello
    ```
  </step>
</stepper>


## Registration forms

All three registration forms are supported:
```csharp
using Nullean.Argh;

var app = new ArghApp();

app.Map("deploy", DeployHandlers.Run);
app.Map("greet", (string name) => Console.WriteLine($"Hello, {name}!"));
app.Map<StorageHandlers>();

return await app.RunAsync(args);
```


## Adding a root command

Use `MapRoot` to define a handler that runs when no subcommand is given:
```csharp
var app = new ArghApp();
app.MapRoot(Handlers.DefaultAction);
app.Map("deploy", Handlers.Deploy);

return await app.RunAsync(args);
```


## App description

For apps without a root command, use `UseCliDescription` to set a one-liner shown beneath the `Usage:` line in `--help`:
```csharp
app.UseCliDescription("Manage and deploy your application's cloud resources.");
```

<important>
  `UseCliDescription` cannot be combined with `MapRoot`. If you have a root command, put the description in its XML doc `<summary>` instead.
</important>