-
Notifications
You must be signed in to change notification settings - Fork 147
feat: Added documenation for patternfly cli. #4981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
494d350
311103c
47ec8f3
2af1111
7128c86
dfdd52f
d526d7f
139bbe5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,132 @@ | ||||||||||
| --- | ||||||||||
| id: PatternFly CLI | ||||||||||
| title: PatternFly CLI | ||||||||||
| section: get-started | ||||||||||
| --- | ||||||||||
|
|
||||||||||
| import './get-started.css'; | ||||||||||
|
|
||||||||||
| The [PatternFly CLI](https://github.com/patternfly/patternfly-cli) is a command-line tool for scaffolding projects, performing code modifications, and running project-related tasks. It aims to streamline development workflows and improve productivity. The published package is [`@patternfly/patternfly-cli` on npm](https://www.npmjs.com/package/@patternfly/patternfly-cli). | ||||||||||
|
|
||||||||||
| ## Features | ||||||||||
|
|
||||||||||
| - **Project scaffolding:** Quickly set up new PatternFly based projects for development, and prototyping. This is done using predefined templates. | ||||||||||
| - **Code modifications:** Automate repetitive code changes that helps users upgrade to the latest version of PatternFly. | ||||||||||
| - **Task runner:** Execute project-related tasks efficiently, such as source code management and task running. | ||||||||||
|
|
||||||||||
|
|
||||||||||
| ## Prerequisites | ||||||||||
|
||||||||||
| ## Prerequisites | |
| ## How do I set up the PatternFly CLI? | |
| ### Prerequisites |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| | Command | Description | | |
| | Command | Usage | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| For the most up-to-date flags and behavior, see the [PatternFly CLI README](https://github.com/patternfly/patternfly-cli/blob/main/README.md) on GitHub. | |
| For the most up-to-date flags and behavior guidance, refer to the [PatternFly CLI README](https://github.com/patternfly/patternfly-cli/blob/main/README.md) on GitHub. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Custom templates | |
| ### Custom templates |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Source and releases | |
| The CLI is developed in the open at [github.com/patternfly/patternfly-cli](https://github.com/patternfly/patternfly-cli). Report issues or contribute there; release notes and tags are published on the repository’s [Releases](https://github.com/patternfly/patternfly-cli/releases) page. |
moving up top?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need this? I can remove it since the guidance link will take you to the readme that will have this information in it. Removing for now, if you want me to add it back let me know.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| --- | ||
| id: PatternFly CLI | ||
| title: PatternFly CLI | ||
| section: get-started | ||
| --- | ||
|
|
||
| import './get-started.css'; | ||
|
|
||
| The [PatternFly CLI](https://github.com/patternfly/patternfly-cli) is a command-line tool for scaffolding projects, performing code modifications, and running project-related tasks. It aims to streamline development workflows and improve productivity. The published package is [`@patternfly/patternfly-cli` on npm](https://www.npmjs.com/package/@patternfly/patternfly-cli). | ||
|
|
||
| ## Features | ||
|
|
||
| - **Project scaffolding:** Quickly set up new projects with predefined templates. | ||
| - **Code modifications:** Automate repetitive code changes. | ||
| - **Task runner:** Execute project-related tasks efficiently. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| If you use the [install script](#install-script-macos-and-linux) on macOS or Linux, it covers the items below (you may still need administrator access for system packages). Otherwise, install the following yourself before using the CLI: | ||
|
|
||
| - **[Node.js and npm](https://nodejs.org/)** (supported versions **20–24**) — also see [npm](https://www.npmjs.com/). | ||
| - **[Corepack](https://nodejs.org/api/corepack.html)** — included with Node.js; enable with `corepack enable` after installing npm. | ||
| - **[GitHub CLI](https://cli.github.com/)** (`gh`) | ||
|
|
||
| ## Installation | ||
|
|
||
| ### Install script (macOS and Linux) | ||
|
|
||
| You can pipe the repository install script into `bash`. It installs Node.js with [nvm](https://github.com/nvm-sh/nvm) when `node` is not available, enables Corepack, installs GitHub CLI when it is missing, then installs the CLI globally from npm: | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/patternfly/patternfly-cli/main/scripts/install.sh | bash | ||
| ``` | ||
|
|
||
| Swap `main` for another branch or tag if you need a specific revision. To save the script and inspect it before running: | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/patternfly/patternfly-cli/main/scripts/install.sh -o install-patternfly-cli.sh | ||
| bash install-patternfly-cli.sh | ||
| ``` | ||
|
|
||
| The script may prompt for `sudo` when your system package manager installs GitHub CLI. | ||
|
|
||
| ### npm | ||
|
|
||
| If you already have the [prerequisites](#prerequisites) on your machine, install the published package globally: | ||
|
|
||
| ```sh | ||
| npm install -g @patternfly/patternfly-cli | ||
| ``` | ||
|
|
||
| ## Uninstall | ||
|
|
||
| ### Uninstall script (macOS and Linux) | ||
|
|
||
| Pipe the repository uninstall script into `bash`. It removes the globally installed `@patternfly/patternfly-cli` package with npm. It does **not** remove Node.js, nvm, Corepack, or GitHub CLI. | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/patternfly/patternfly-cli/main/scripts/uninstall.sh | bash | ||
| ``` | ||
|
|
||
| Swap `main` for another branch or tag if you need a specific revision. To save the script and inspect it before running: | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/patternfly/patternfly-cli/main/scripts/uninstall.sh -o uninstall-patternfly-cli.sh | ||
| bash uninstall-patternfly-cli.sh | ||
| ``` | ||
|
|
||
| ### npm | ||
|
|
||
| If you installed with npm globally, remove the package with: | ||
|
|
||
| ```sh | ||
| npm uninstall -g @patternfly/patternfly-cli | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| After installation, run: | ||
|
|
||
| ```sh | ||
| patternfly-cli [command] | ||
| ``` | ||
|
|
||
| ### Available commands | ||
|
|
||
| | Command | Description | | ||
| | --- | --- | | ||
| | `create` | Create a new project from the available templates. | | ||
| | `list` | List all available templates (built-in and optional custom). | | ||
| | `update` | Update your project to a newer version. | | ||
| | `cli-upgrade` | Upgrade the globally installed CLI to the latest npm release. It runs `npm install -g @patternfly/patternfly-cli@latest`; use your package manager’s equivalent if you did not install with npm. | | ||
| | `init` | Initialize a git repository and optionally create a GitHub repository. | | ||
| | `save` | Commit and push changes to the current branch. | | ||
| | `load` | Pull the latest updates from GitHub. | | ||
| | `deploy` | Build and deploy your app to GitHub Pages. | | ||
|
|
||
| For the most up-to-date flags and behavior, see the [PatternFly CLI README](https://github.com/patternfly/patternfly-cli/blob/main/README.md) on GitHub. | ||
|
|
||
| ## Custom templates | ||
|
|
||
| You can add your own templates in addition to the built-in ones by passing a JSON file with `--template-file` (or `-t`). Custom templates are merged with the built-in list; if a custom template has the same `name` as a built-in one, the custom definition is used. | ||
|
|
||
| **Create with custom templates:** | ||
|
|
||
| ```sh | ||
| patternfly-cli create my-app --template-file ./my-templates.json | ||
| ``` | ||
|
|
||
| **List templates including custom file:** | ||
|
|
||
| ```sh | ||
| patternfly-cli list --template-file ./my-templates.json | ||
| ``` | ||
|
|
||
| **JSON format** (array of template objects, same shape as the built-in templates): | ||
|
|
||
| ```json | ||
| [ | ||
| { | ||
| "name": "my-template", | ||
| "description": "My custom project template", | ||
| "repo": "https://github.com/org/repo.git", | ||
| "options": ["--single-branch", "--branch", "main"], | ||
| "packageManager": "npm" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| - **`name`** (required): Template identifier. | ||
| - **`description`** (required): Short description shown in prompts and `list`. | ||
| - **`repo`** (required): Git clone URL. | ||
| - **`options`** (optional): Array of extra arguments for `git clone` (e.g. `["--single-branch", "--branch", "main"]`). | ||
| - **`packageManager`** (optional): `npm`, `yarn`, or `pnpm`; defaults to `npm` if omitted. | ||
|
|
||
| ## Source and releases | ||
|
|
||
| The CLI is developed in the open at [github.com/patternfly/patternfly-cli](https://github.com/patternfly/patternfly-cli). Report issues or contribute there; release notes and tags are published on the repository’s [Releases](https://github.com/patternfly/patternfly-cli/releases) page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the get started section is more so intended for introductory/overview information. Are you set on including these docs there? Otherwise, we could move to /developer-guides or maybe at least nest it under get-started/develop (assuming this is a dev-focused tool)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for both designers and developers. At the moment it's geared towards designers more. I'm good with putting it under developer guides