From 7e79016611355e49c6c94f9b7803ddd402933782 Mon Sep 17 00:00:00 2001 From: "A.J. Stein" Date: Thu, 5 Sep 2024 00:53:52 -0400 Subject: [PATCH] Maven plugin downloads, formatting of code blocks This commit adds more information on quickly and effectively using Maven. Also, I added ` ```sh` fences to code blocks for shell commands. I also added example of adding to shell configuration files. --- README.md | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index dea8d7d..75c07a6 100644 --- a/README.md +++ b/README.md @@ -27,32 +27,54 @@ This project is in the worldwide [public domain](LICENSE.md) and as stated in [C ### Installing pre-built Java package 1. Make a directory to install oscal-cli and cd into it. The example below uses the directory `/opt/oscal-cli`. Use your preferred directory. + +```sh +mkdir -p /opt/oscal-cli ``` -mkdir -p /opt/oscal-cli && cd /opt/oscal-cli -``` -NOTE: -2. Download the zipped oscal-cli Java package. Download your preferred version, but we recommend [the latest stable release on the Maven Central repository](https://central.sonatype.com/artifact/dev.metaschema.oscal/oscal-cli/). +2. Download the zipped oscal-cli Java package to the install directory. Download your preferred version, but we recommend [the latest stable release on the Maven Central repository](https://central.sonatype.com/artifact/dev.metaschema.oscal/oscal-cli/). You can use [the Maven tool](https://maven.apache.org/) instead of in place of additional command line tools (i.e. `curl`; `wget`; etc.) or browser to craft URLs for a specific version. -3. Extract oscal-cli into the directory. +```sh +mvn \ + org.apache.maven.plugins:maven-dependency-plugin:LATEST:copy \ + -DoutputDirectory=/opt/oscal-cli \ + -DremoteRepositories=https://repo1.maven.org/maven2 \ + -Dartifact=dev.metaschema.oscal:oscal-cli-enhanced:LATEST:zip:oscal-cli ``` -unzip cli-core-1.0.1-oscal-cli.zip + +3. Move, extract oscal-cli, and delete the zipped package from the install directory. + +```sh +cd /opt/oscal-cli +unzip *.zip +rm *.zip ``` 4. (Recommended) Add oscal-cli's directory to your path. -``` + +```sh # temporarily add oscal-cli to your terminal's instance path PATH=$PATH:/opt/oscal-cli/bin # add oscal-cli to your environment (e.g., all terminals) export PATH=$PATH:/opt/oscal-cli/bin ``` -NOTE: You can also add oscal-cli's directory to your path in shell profile to make oscal-cli permanently available. -## Running +5. You can optionally add oscal-cli's directory to your path in shell profile (i.e. [`$HOME/.bashrc`](https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html); [`$HOME/.zshrc`](https://zsh.sourceforge.io/Guide/zshguide02.html); etc.) to make oscal-cli permanently available. -Run help to make sure everything work +```sh +# You do not need to use both, pick one. +# Use the command below for bash shells. +echo 'export PATH=$PATH:/opt/oscal-cli/bin' >> ~/.bashrc +# Use this command for zsh shells. +echo 'export PATH=$PATH:/opt/oscal-cli/bin' >> ~/.zshrc ``` + +## Running + +Run help to make sure everything works. + +```sh # if oscal-cli directory added to your path oscal-cli --help