Copia-cli: Streamlining Industrial Automation with Command-Line Efficiency
Primary Purpose:
Copia-cli is a command-line interface tool designed to interact seamlessly with Copia, a source control platform tailored for industrial automation. It offers developers and professionals the ability to manage repositories, issues, pull requests, and more directly from their terminal, mirroring the functionality of GitHub CLI (gh) but adapted for industrial applications.
Key Features:
Authentication Integration: Securely authenticate with Copia Cloud using token-based login.
Repository Management: List, view, and clone repositories efficiently.
Issue Tracking: Create, manage, and track issues with ease, including assigning labels and milestones.
Pull Request Handling: Create, review, merge, and delete pull requests directly from the command line.
Shell Completion Support: Enhance productivity with shell completion for Bash, Zsh, Fish, and PowerShell.
Copa Cloud Integration: Fully integrated with Copia Cloud, ensuring seamless workflow across platforms.
Audience & Benefit:
Ideal for industrial automation professionals and developers working within Git environments, copia-cli empowers users to integrate Copia functionality into their existing terminal workflows. By bringing source control operations directly to the command line, it enhances efficiency, reduces context switching, and streamlines development processes, ultimately boosting productivity in industrial automation projects.
Installation:
Copia-cli can be installed via winget, making setup straightforward and accessible for users on supported platforms. This integration ensures that developers can quickly start leveraging Copia's features within their familiar terminal environment.
README
Copia CLI
copia-cli is Copia on the command line. It brings repositories, issues, pull requests, and other Copia concepts to the terminal next to where you are already working with git and your code.
Copia CLI is supported for users on Copia Cloud, with support for Linux, macOS, and Windows.
The manual and the installation guides are on the documentation site. CI builds it with MkDocs Material and the Qubernetic docs theme, which is a private submodule (docs/site/brand). Without access to the theme a local build of the site fails; the CLI, the tests and the generated command pages (just docs) build as usual.
Contributing
If anything feels off, or if you feel that some functionality is missing, please check out the contributing page. There you will find instructions for sharing your feedback, building the tool locally, and submitting pull requests to the project.
# Authenticate
$ copia-cli auth login --host app.copia.io --token YOUR_TOKEN
# List your repos
$ copia-cli repo list
$ copia-cli repo list --visibility private
# Create an issue
$ copia-cli issue create --title "Fix sensor mapping" --label bug --assignee @me --milestone v1.0
# Show the open issues assigned to you, mentioning you and opened by you
$ copia-cli issue status
# List the issues assigned to you in that milestone
$ copia-cli issue list --assignee @me --milestone v1.0 --search "sensor"
# Print only some fields as JSON, filter them with a jq expression, or format them with a Go template
$ copia-cli issue list --json number,title
$ copia-cli issue list --json number,title --jq '.[].title'
$ copia-cli issue list --json number,title --template '{{range .}}{{tablerow .number .title}}{{end}}'
# Move it to another milestone, by name or ID
$ copia-cli issue edit 13 --milestone v1.1
# Hand it over and drop a label
$ copia-cli issue edit 13 --add-assignee jane --remove-assignee john --remove-label triage
# Open a PR
$ copia-cli pr create --title "feat: add safety interlock" --base develop
# Open a draft PR from the current branch, title and body filled from its commits
$ copia-cli pr create --fill --draft --base develop
# Take the PR body from a file (or "-" for standard input)
$ copia-cli pr create --title "docs: add manual" --base develop --body-file notes.md
# Open a PR with metadata and request reviews from a person and a team
$ copia-cli pr create --title "feat: add safety interlock" --base develop \
--assignee @me --label plc --milestone v1.0 --reviewer jane --reviewer my-org/controls
# Show the PR of the current branch, your open PRs and the ones waiting for your review
$ copia-cli pr status
# Merge it
$ copia-cli pr merge 7 --merge --delete-branch --body "Tested on the line 3 PLC"
# Open the repository, or issue or pull request 7, in the browser (--no-browser prints the URL)
$ copia-cli browse
$ copia-cli browse 7
# Open a file at a line on a branch, its blame view, or the repository settings
$ copia-cli browse main.st:312 --branch bug-fix
$ copia-cli browse main.st:312 --blame
$ copia-cli browse --settings
# Your assigned issues and PRs, review requests, mentions and notifications across repositories
$ copia-cli status --org my-org --exclude my-org/archive
# Show and change the settings (output, browser, pager, editor)
$ copia-cli config list
$ copia-cli config set browser "firefox --new-tab"
$ copia-cli config get browser
# Page long output through less; COPIA_PAGER= turns it off for one call
$ copia-cli config set pager "less -R"
# Print JSON with every field by default; COPIA_OUTPUT=table overrides it for one call
$ copia-cli config set output json
$ copia-cli issue list --jq '.[].title'
# Shortcuts: copia-cli bugs urgent runs issue list --label urgent
$ copia-cli alias set bugs 'issue list --label $1'
$ copia-cli alias list
# In a fork with an upstream remote, work on the upstream repository by default
$ copia-cli repo set-default my-org/my-repo
$ copia-cli repo set-default --view
# Call any API endpoint: fetch every page and keep only the titles
$ copia-cli api --paginate /repos/my-org/my-repo/issues --jq '.[].title'
Shell Completion
Shell completion is available for Bash, Zsh, Fish, and PowerShell. See copia-cli completion --help or the manual for setup instructions.