Install the CLI
hakocms-cli is a single executable. Download it, extract it, and put it in a folder on your PATH, and you can use it.
Supported operating systems
Section titled “Supported operating systems”| OS | CPU | File |
|---|---|---|
| Linux (any distribution) | x86_64 | hakocms-cli-v<version>-x86_64-unknown-linux-musl.tar.gz |
| Linux | aarch64 (arm64) | hakocms-cli-v<version>-aarch64-unknown-linux-musl.tar.gz |
| macOS | Apple silicon (M1 or later) | hakocms-cli-v<version>-aarch64-apple-darwin.tar.gz |
| macOS | Intel | hakocms-cli-v<version>-x86_64-apple-darwin.tar.gz |
| Windows 10 or later | x86_64 | hakocms-cli-v<version>-x86_64-pc-windows-gnu.zip |
The files are at https://download.hakocms.net/hakocms-cli/v<version>/. The latest version number, and the URL and SHA-256 of each file, are in the following file.
https://download.hakocms.net/hakocms-cli/latest.jsonTo download in a browser, go to CLI download on the product site. It lists the files of the latest version with their SHA-256.
Linux and macOS
Section titled “Linux and macOS”Run the following command in a terminal.
curl -fsSL https://www.hakocms.net/install.sh | shIf you see the following, it is installed. <version> is the version number you installed (such as 0.1.8), and <target> is the name of the OS and CPU (such as aarch64-apple-darwin).
hakocms-cli v<version>(<target>)をダウンロードしています<home>/.local/bin/hakocms-cli に置きました<home> is your home folder (such as /home/hako or /Users/hako).
This command downloads the latest version, checks with SHA256SUMS that the file is not corrupted, and then puts it at ~/.local/bin/hakocms-cli. You do not need administrator privileges (sudo). If ~/.local/bin is not on your PATH, the command shows a line to add to your shell configuration file. Add that line to ~/.zshrc or ~/.bashrc, and open a new terminal.
To read the script before you run it, open install.sh.
To change the install location or the version, put environment variables before sh.
| Environment variable | Meaning | Default |
|---|---|---|
HAKOCMS_CLI_INSTALL_DIR |
Install location | ~/.local/bin |
HAKOCMS_CLI_VERSION |
Version to install (such as 0.1.8) |
The latest version |
For example, to put it in /usr/local/bin, do the following.
curl -fsSL https://www.hakocms.net/install.sh | sudo HAKOCMS_CLI_INSTALL_DIR=/usr/local/bin shInstall manually
Section titled “Install manually”You can also install it by running the commands one at a time. The following steps download the latest version, check that the file is not corrupted, and then put it in /usr/local/bin.
-
Choose the target for your OS and CPU.
ターミナルウィンドウ # Linux (x86_64)TARGET=x86_64-unknown-linux-musl# Linux (arm64): aarch64-unknown-linux-musl# macOS (Apple silicon): aarch64-apple-darwin# macOS (Intel): x86_64-apple-darwinIf you are not sure which one, run
uname -sm. It shows one ofLinux x86_64,Linux aarch64,Darwin arm64(Apple silicon), orDarwin x86_64(Intel). -
Look up the latest version number.
ターミナルウィンドウ VERSION=$(curl -fsSL https://download.hakocms.net/hakocms-cli/latest.json |sed -n 's/.*"version": *"\([^"]*\)".*/\1/p')echo "$VERSION"A version number such as
0.1.8is shown. -
Download the file and
SHA256SUMS, which you use to verify it.ターミナルウィンドウ BASE=https://download.hakocms.net/hakocms-cli/v$VERSIONNAME=hakocms-cli-v$VERSION-$TARGETcurl -fsSLO "$BASE/$NAME.tar.gz"curl -fsSLO "$BASE/SHA256SUMS" -
Check that the file is not corrupted.
ターミナルウィンドウ # Linuxgrep " $NAME.tar.gz\$" SHA256SUMS | sha256sum -c -# macOSgrep " $NAME.tar.gz\$" SHA256SUMS | shasum -a 256 -c -If
hakocms-cli-v<version>-<target>.tar.gz: OKis shown, the file is not corrupted. IfFAILEDis shown, download it again. -
Extract it and put it in
/usr/local/bin.ターミナルウィンドウ tar xzf "$NAME.tar.gz"sudo install "$NAME/hakocms-cli" /usr/local/bin/If you do not have administrator privileges, put it in your own folder (
mkdir -p ~/.local/bin && install "$NAME/hakocms-cli" ~/.local/bin/). If~/.local/binis not on your PATH, addexport PATH="$HOME/.local/bin:$PATH"to your shell configuration file.
Besides hakocms-cli, the extracted folder contains the license (LICENSE), the licenses of other software it includes (THIRD_PARTY_LICENSES), and README.txt.
If macOS blocks it from running
Section titled “If macOS blocks it from running”hakocms-cli is not signed by Apple. If you download the file in a browser and open and extract it in Finder, macOS marks the extracted file to block it from running. When you run that hakocms-cli, macOS shows a warning and stops it. In that case, remove the mark with the following command.
xattr -d com.apple.quarantine /usr/local/bin/hakocms-cliIf you installed with the one-line command, downloaded with curl as in the steps above, or extracted with tar in a terminal, the mark is not added, so you do not need this command.
Windows
Section titled “Windows”In PowerShell, do the following.
-
Download the latest version.
ターミナルウィンドウ $latest = Invoke-RestMethod https://download.hakocms.net/hakocms-cli/latest.json$asset = $latest.assets.'x86_64-pc-windows-gnu'Invoke-WebRequest $asset.url -OutFile $asset.name -
Check that the file is not corrupted.
ターミナルウィンドウ (Get-FileHash $asset.name -Algorithm SHA256).Hash.ToLower() -eq $asset.sha256If
Trueis shown, the file is not corrupted. -
Extract it and put it in a folder on your PATH.
ターミナルウィンドウ Expand-Archive $asset.name -DestinationPath .$dir = "$env:LOCALAPPDATA\Programs\hakocms-cli"New-Item -ItemType Directory -Force $dir | Out-NullCopy-Item "$($asset.name -replace '\.zip$','')\hakocms-cli.exe" $dir -
Add that folder to your PATH (only the first time you install).
ターミナルウィンドウ $path = [Environment]::GetEnvironmentVariable("Path", "User")[Environment]::SetEnvironmentVariable("Path", "$path;$dir", "User")The updated PATH is available in PowerShell windows you open after this.
Verify
Section titled “Verify”Open a new terminal and run the following command.
hakocms-cli versionIf a version number is shown as follows, it is installed. <version> is the version number you installed (such as 0.1.8).
hakocms-cli <version> (Admin API 1)If command not found is shown, the folder you put it in is not on your PATH.
Next, log in (Log in with the CLI).
Install shell completion
Section titled “Install shell completion”(Optional) Let the Tab key complete commands and flags. Run the one for your shell, and open a new terminal.
# zshhakocms-cli completion zsh > "${fpath[1]}/_hakocms-cli"# bashmkdir -p ~/.local/share/bash-completion/completionshakocms-cli completion bash > ~/.local/share/bash-completion/completions/hakocms-cli# fishhakocms-cli completion fish > ~/.config/fish/completions/hakocms-cli.fishIn PowerShell, add hakocms-cli completion powershell | Out-String | Invoke-Expression to your profile ($PROFILE).
Upgrade
Section titled “Upgrade”To move to a new version, repeat the same steps you used to install. If you installed with the one-line command, run the same command again. The manual install steps also look up the latest version from latest.json, so you can use them as they are without editing. If you put the file in the same place, it replaces the old one. Your login information and settings keep working.
hakocms-cli version shows your current version. Step 2 of “Install manually” for Linux and macOS shows the latest version (on Windows, $latest.version after step 1).
Uninstall
Section titled “Uninstall”-
If you are logged in, log out first. This revokes the access token.
ターミナルウィンドウ hakocms-cli auth logout -
Delete the executable. If you installed with the one-line command, run
rm ~/.local/bin/hakocms-cli. If you installed manually, runsudo rm /usr/local/bin/hakocms-cli. On Windows, delete the%LOCALAPPDATA%\Programs\hakocms-clifolder. -
Delete the settings folder (
~/.config/hakocms-cli; on Windows,%APPDATA%\hakocms-cli).