{"id":19380343,"url":"https://github.com/atata-framework/atata-cli","last_synced_at":"2025-04-23T19:33:33.680Z","repository":{"id":43489389,"uuid":"379647236","full_name":"atata-framework/atata-cli","owner":"atata-framework","description":".NET library that provides an API for CLI.","archived":false,"fork":false,"pushed_at":"2025-04-08T14:37:52.000Z","size":210,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T09:04:35.192Z","etag":null,"topics":["api","atata","cli"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atata-framework.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"atata"}},"created_at":"2021-06-23T15:21:34.000Z","updated_at":"2025-04-08T14:37:55.000Z","dependencies_parsed_at":"2024-04-13T18:20:22.302Z","dependency_job_id":"12c03928-203d-47e5-abd1-dd4257450dcb","html_url":"https://github.com/atata-framework/atata-cli","commit_stats":{"total_commits":89,"total_committers":1,"mean_commits":89.0,"dds":0.0,"last_synced_commit":"baf64142cdbc8161ad871d87420f691458671980"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":"atata-framework/atata-repository-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atata-framework%2Fatata-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atata-framework%2Fatata-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atata-framework%2Fatata-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atata-framework%2Fatata-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atata-framework","download_url":"https://codeload.github.com/atata-framework/atata-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250398673,"owners_count":21424029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","atata","cli"],"created_at":"2024-11-10T09:13:41.634Z","updated_at":"2025-04-23T19:33:33.617Z","avatar_url":"https://github.com/atata-framework.png","language":"C#","funding_links":["https://opencollective.com/atata"],"categories":[],"sub_categories":[],"readme":"# Atata.Cli\n\n[![NuGet](http://img.shields.io/nuget/v/Atata.Cli.svg?style=flat)](https://www.nuget.org/packages/Atata.Cli/)\n[![GitHub release](https://img.shields.io/github/release/atata-framework/atata-cli.svg)](https://github.com/atata-framework/atata-cli/releases)\n[![Build status](https://dev.azure.com/atata-framework/atata-cli/_apis/build/status/atata-cli-ci?branchName=main)](https://dev.azure.com/atata-framework/atata-cli/_build/latest?definitionId=41\u0026branchName=main)\n[![Slack](https://img.shields.io/badge/join-Slack-green.svg?colorB=4EB898)](https://join.slack.com/t/atata-framework/shared_invite/zt-5j3lyln7-WD1ZtMDzXBhPm0yXLDBzbA)\n[![Atata docs](https://img.shields.io/badge/docs-Atata_Framework-orange.svg)](https://atata.io)\n[![Twitter](https://img.shields.io/badge/follow-@AtataFramework-blue.svg)](https://twitter.com/AtataFramework)\n\n**Atata.Cli** is a .NET library that provides an API for CLI.\n\n*The package targets .NET Standard 2.0, which supports .NET 5+, .NET Framework 4.6.1+ and .NET Core/Standard 2.0+.*\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [CLI Command Factories](#cli-command-factories)\n- [Feedback](#feedback)\n- [SemVer](#semver)\n- [License](#license)\n\n## Features\n\n- Provides an abstraction over `System.Diagnostics.Process` with `CliCommand` and `ProgramCli` classes.\n- Has ability to execute CLI through command shell: cmd, sh, bash, sudo, etc.\n- Provides synchronous and asynchronous API methods.\n- Works on Windows, Linux and macOS.\n\n## Installation\n\nInstall [`Atata.Cli`](https://www.nuget.org/packages/Atata.Cli/) NuGet package.\n\n- Package Manager:\n  ```\n  Install-Package Atata.Cli\n  ```\n\n- .NET CLI:\n  ```\n  dotnet add package Atata.Cli\n  ```\n\n## Usage\n\n### Execute Command to Get Value\n\n```cs\nCliCommandResult result = new ProgramCli(\"dotnet\")\n    .Execute(\"--version\");\n\nstring version = result.Output;\n```\n\n### Execute Command in Directory\n\n```cs\nnew ProgramCli(\"dotnet\")\n    .WithWorkingDirectory(\"some/path\")\n    .Execute(\"build -c Release\");\n```\n\n### Execute Command Through Command Shell\n\n```cs\nnew ProgramCli(\"npm\", useCommandShell: true)\n    .Execute(\"install -g html-validate\");\n```\n\n*The default command shell for Windows is \"cmd\", for other OSs it is \"sh\".*\n\n### Execute Command Through Specific Command Shell\n\n```cs\nnew ProgramCli(\"npm\", new BashShellCliCommandFactory(\"-login\"))\n    .Execute(\"install -g html-validate\");\n```\n\nor\n\n```cs\nnew ProgramCli(\"npm\")\n    .WithCliCommandFactory(new BashShellCliCommandFactory(\"-login\"))\n    .Execute(\"install -g html-validate\");\n```\n\n### Set Default Shell CLI Command Factory\n\nThe default shell CLI command factory can be set in a global setup/initialization method.\n\n#### Set for Any Operating System\n\n```cs\nProgramCli.DefaultShellCliCommandFactory = new BashShellCliCommandFactory();\n```\n\n#### Set Specific to Operating System\n\n```cs\nProgramCli.DefaultShellCliCommandFactory = OSDependentShellCliCommandFactory\n    .UseCmdForWindows()\n    .UseForOtherOS(new BashShellCliCommandFactory(\"-login\"));\n```\n\n## CLI Command Factories\n\nThere are several predefined classes that implement `ICliCommandFactory`:\n\n- `DirectCliCommandFactory` - executes the command directly. The default one.\n- `CmdShellCliCommandFactory` - executes the command through the Windows cmd shell program.\n- `BashShellCliCommandFactory` - executes the command through the Unix Bash shell program.\n- `ShShellCliCommandFactory` - executes the command through the Unix sh shell program.\n- `SudoShellCliCommandFactory` - executes the command through the Unix sudo shell program.\n- `OSDependentShellCliCommandFactory` - executes the command through one of the registered in it\n  shell `ICliCommandFactory` instances depending on the current operating system.\n- `UnixShellCliCommandFactory` - executes the command through the specified Unix shell program.\n- `ShellCliCommandFactory` - base factory class that executes the command through the specified shell program.\n\n## Feedback\n\nAny feedback, issues and feature requests are welcome.\n\nIf you faced an issue please report it to [Atata.Cli Issues](https://github.com/atata-framework/atata-cli/issues),\n[ask a question on Stack Overflow](https://stackoverflow.com/questions/ask?tags=atata+csharp) using [atata](https://stackoverflow.com/questions/tagged/atata) tag\nor use another [Atata Contact](https://atata.io/contact/) way.\n\n## SemVer\n\nAtata Framework follows [Semantic Versioning 2.0](https://semver.org/).\nThus backward compatibility is followed and updates within the same major version\n(e.g. from 1.3 to 1.4) should not require code changes.\n\n## License\n\nAtata is an open source software, licensed under the Apache License 2.0.\nSee [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatata-framework%2Fatata-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatata-framework%2Fatata-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatata-framework%2Fatata-cli/lists"}