Og-CLI
Installation
1. Install the gh CLI tool
Prior to beginning install the gh CLI tool from GitHub.
You can do so by running the following command if you have homebrew installed, otherwise follow the instructions on the GitHub page:
Then authenticate to GitHub by running:2. Clone the lpd-scripts repo
Next clone the lpd-scripts repo by running:
cd into the lpd-scripts directory and run:
3. Install og-cli
Finally run the install script:
This will install the og-cli to your machine and add it to your path. You can now run og in your terminal to see a list of available commands.
4. Optionally: add an update alias
If using FISH as your shell you can add an alias to your config.fish file to make updating the og-cli easier. Example:
See fish shell documentation for more information on how to use functions and aliases.About
og-CLI is made to work with Origins.
It is a command line interface that allows you to interact with your Origins projects by assisting with the creation of various components.
By running og in your terminal you will be shown a list of available commands.
Commands
og make:block BlockName {--jsx} {--align-full}
Creates a block in the blocks directory.
A category can be passed before the blockname to create the block in a subdirectory of the blocks directory.
If the subdirectory does not exist, it will be created.
Example:
This command will create a block in theblocks/Container directory with the name Large.
--jsx
changes the block.json file to have "jsx" : true which allows for the <InnerBlocks /> component to be used in the block.
--align-full
adds the attributes needed to make the block align full width by default. og make:hook
og make:context-provider ContextProviderName
Creates a context provider in the app/Providers/TemplateContext directory.
Example:
This command will create a context provider in theapp/Providers/TemplateContext directory with the name Staff.
og make:hook HookName {--action} {--filter} {--admin}
A category can be passed before the hookname to create the hook in a subdirectory of the hooks directory.
If the subdirectory does not exist, it will be created.
Example:
This command will create a hook in thehooks/Post directory with the name BeforeContent.
--action
will create an action hook.
--filter
will create a filter hook.
--admin
will add is_admin() to the hooks should_load function.
Note: If no flags are passed, the hook will be created as an action hook. Both --action and --filter can be passed at the same time.