Presenting Atata.Cli

July 26, 2021 by Yevgeniy Shunevych

New Atata.Cli and Atata.Cli.Npm .NET libraries are released to help you work with CLI programs.


Atata.Cli is a .NET library that provides an API for CLI.

Find out more information on the library on Atata.Cli GitHub repository README page.


  • Provides an abstraction over System.Diagnostics.Process with CliCommand and ProgramCli classes.
  • Has ability to execute CLI through command shell (cmd/bash).
  • Provides synchronous and asynchronous API methods.
  • Works on Windows, Linux and macOS.


Execute Command to Get Value

CliCommandResult result = new ProgramCli("dotnet")

string version = result.Output;

Execute Command in Directory

new ProgramCli("dotnet")
    .Execute("build -c Release");

Execute Command Through Command Shell

new ProgramCli("npm", useCommandShell: true)
    .Execute("install -g html-validate");


Atata.Cli.Npm is a .NET library that provides an API for NPM.

Find out more information on the library on Atata.Cli.Npm GitHub repository README page.


  • Checks whether NPM is installed.
  • Checks whether package is installed.
  • Gets installed package version.
  • Installs package.
  • Uninstalls package.

The main class is NpmCli located in Atata.Cli.Npm namespace.

There is also GlobalNpmPackageCli<TCli>, which can be used as a base class of specific NPM package CLI.


Check NPM is Installed

bool isNpmInstalled = new NpmCli()

Ensure NPM is Installed

new NpmCli()

If NPM isn’t installed, throws NpmNotFoundException.

Install Package Into Directory

    .Install("npm-package-name-2", "1.2.3");

Install Package Globally

new NpmCli()
    .Install("html-validate", global: true);

Install Package If Missing

    .InstallIfMissing("html-validate", global: true);

Check Package is Installed

bool isPackageInstalled = new NpmCli()
    .IsInstalled("html-validate", global: true);

Check Specific Package Version is Installed

bool isPackageVersionInstalled = new NpmCli()
    .IsInstalled("html-validate", "5.0.0", global: true);

Get Installed Package Version

string packageVersion = new NpmCli()
    .GetInstalledVersion("html-validate", global: true);

Uninstall Package

new NpmCli()
    .Uninstall("html-validate", global: true);