13 Commits

Author SHA1 Message Date
agresdominik 6f92c3b1e7 Update ci.yml 2026-03-23 19:29:15 +01:00
agresdominik b3e6a430cb Create release.yml 2026-03-23 19:27:37 +01:00
agresdominik 2ad2fa52db Merge remote-tracking branch 'refs/remotes/origin/main' 2026-03-23 19:25:16 +01:00
agresdominik 527ef5e15a chore: release 0.1.0 2026-03-23 19:24:40 +01:00
agresdominik aa17c8abd7 Create ci.yml 2026-03-23 19:21:30 +01:00
agresdominik 2fc4ea34f7 Added markserv to commands.json 2026-01-31 00:51:39 +01:00
agresdominik c268ce51d0 Added some pdf related commands 2025-12-15 21:28:06 +01:00
agresdominik 6508479b98 Other applications and package managers 2025-12-12 00:25:53 +01:00
agresdominik c6f677b169 Readme update 2025-12-11 16:16:25 +01:00
agresdominik 5bb45ca959 Pre commit to check json validity 2025-12-11 15:48:24 +01:00
agresdominik 3bd7eff5e9 Removed trailing comma 2025-12-11 15:39:55 +01:00
agresdominik 54e1d5bbd4 Command 2025-12-11 15:36:21 +01:00
agresdominik 1cfc374d70 new commands 2025-12-11 15:09:31 +01:00
6 changed files with 330 additions and 3 deletions
+114
View File
@@ -0,0 +1,114 @@
# .github/workflows/ci.yml
#
# Runs on every push to main and on every pull request targeting main.
# Pipeline: golangci-lint → go test → make build
# If all three pass on main, the release workflow is triggered automatically.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m ./src/...
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./src/...
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.out
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build binary
run: make build
- name: Smoke test binary
run: ./bin/cheatsh --help
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: cheatsh-${{ runner.os }}
path: bin/cheatsh
# Only fires on pushes to main (not PRs) after build passes.
# Checks whether the VERSION file was changed — if so, triggers a release.
trigger-release:
name: Trigger Release
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
outputs:
version_changed: ${{ steps.check.outputs.changed }}
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2 # need the previous commit to diff
- name: Check if VERSION changed
id: check
run: |
if git diff HEAD~1 HEAD --name-only | grep -q '^VERSION$'; then
VERSION=$(cat VERSION)
echo "changed=true" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION changed to $VERSION — release will be created."
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "VERSION unchanged — skipping release."
fi
release:
name: Release
needs: [trigger-release]
if: needs.trigger-release.outputs.version_changed == 'true'
uses: ./.github/workflows/release.yml
with:
version: ${{ needs.trigger-release.outputs.version }}
secrets: inherit
permissions:
contents: write
+107
View File
@@ -0,0 +1,107 @@
# .github/workflows/release.yml
#
# Called by ci.yml when VERSION changes on main.
# Can also be triggered manually via workflow_dispatch for hotfixes.
name: Release
on:
workflow_call:
inputs:
version:
required: true
type: string
workflow_dispatch:
inputs:
version:
description: 'Version to release (without v prefix, e.g. 1.2.0)'
required: true
type: string
jobs:
release:
name: Tag, Build & Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate version matches VERSION file
run: |
FILE_VERSION=$(cat VERSION)
INPUT_VERSION="${{ inputs.version }}"
if [ "$FILE_VERSION" != "$INPUT_VERSION" ]; then
echo "ERROR: VERSION file ($FILE_VERSION) does not match input ($INPUT_VERSION)"
exit 1
fi
- name: Check tag availability
run: |
TAG="v${{ inputs.version }}"
if git ls-remote --tags origin | grep -q "refs/tags/$TAG$"; then
echo "ERROR: Tag $TAG already exists."
exit 1
fi
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build
run: make build
- name: Create git tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ inputs.version }}" -m "Release v${{ inputs.version }}"
git push origin "v${{ inputs.version }}"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
name: v${{ inputs.version }}
generate_release_notes: true
files: bin/cheatsh
- name: Compute tarball sha256
id: sha
run: |
URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${{ inputs.version }}.tar.gz"
echo "Waiting briefly for GitHub to process the release tarball..."
sleep 10
SHA=$(curl -sL "$URL" | sha256sum | cut -d' ' -f1)
echo "sha=$SHA" >> $GITHUB_OUTPUT
echo "url=$URL" >> $GITHUB_OUTPUT
echo "Tarball URL : $URL"
echo "SHA256 : $SHA"
# - name: Checkout homebrew tap
# uses: actions/checkout@v4
# with:
# repository: TODO_GITHUB_USER/homebrew-myapps # TODO: your tap repo
# token: ${{ secrets.TAP_GITHUB_TOKEN }}
# path: tap
#- name: Patch cheatsh formula
# run: |
# FORMULA="tap/Formula/cheatsh.rb"
# sed -i "s|url .*|url \"${{ steps.sha.outputs.url }}\"|" "$FORMULA"
# sed -i "s|version .*|version \"${{ inputs.version }}\"|" "$FORMULA"
# sed -i "s|sha256 .*|sha256 \"${{ steps.sha.outputs.sha }}\"|" "$FORMULA"
#- name: Commit and push tap update
# run: |
# cd tap
# git config user.name "github-actions[bot]"
# git config user.email "github-actions[bot]@users.noreply.github.com"
# git diff --quiet && echo "Formula already up to date." && exit 0
# git commit -am "formula: bump cheatsh to v${{ inputs.version }}"
# git push
+8
View File
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-json
name: Check if JSON is valid
files: ^data/.*\.json$
+15 -2
View File
@@ -1,2 +1,15 @@
# cheat_sheet
A man-style cli cheatsheet tool for commands I use and forget a lot
# Cheat Sheet
A small TUI Tool which displays a pre-configured json file content in a menu and lets the user search for commands and select them. Once selected these are printed in the terminal for easy access.
I wrote this to simplify my search for commands I use often enough to need them multiple times but not often enoigh to remember alway exactly how they are called.
Written in go + used bubbletea for the TUI part of the application.
## Usage
Use the commands in the given makefile to run, build, test in a docker container or install the application on your device. Beforehand define your own commands.json based on the `commands_template.json` in the `data/` folder.
Once installed just run `cheatsh` in the terminal. If it's not found, make sure `~/.local/bin/` is in your `PATH` or change the path under the `PREFIX` variable in the `Makefile`.
+1
View File
@@ -0,0 +1 @@
0.1.0
+85 -1
View File
@@ -39,6 +39,10 @@
{
"command": "zip -r folder_name.zip folder_name",
"desc": "Zip a folder and all of its contents into a archive"
},
{
"command": "ln -s /path/to/file file",
"desc": "Create a symbolic link pointing to a file on the system"
}
],
"python": [
@@ -119,13 +123,25 @@
"desc": "Rebase commits from source branch to target branch"
},
{
"command": "git stash",
"command": "git merge <target_branch>",
"desc": "Merge commits from another branch into the one command is run on"
},
{
"command": "git stash push -m 'Message/Stash Name'",
"desc": "Stash changes without commiting"
},
{
"command": "git stash pop",
"desc": "Stash changes without commiting (add stash@{n} for specific stash from 'git stash list'"
},
{
"command": "git reflog",
"desc": "Show history of all changes"
},
{
"command": "git status",
"desc": "See what is changed right now"
},
{
"command": "git remote set-url origin git@github.com:username/repo.git",
"desc": "Change origin url (example from https to ssh)"
@@ -190,5 +206,73 @@
"command": "arch-audit",
"desc": "Audit installed packages for known vulnerabilities (pacman)"
}
],
"package managers": [
{
"command": "pacman -Syu / yay -Syu / dnf update / apt update && apt upgrade",
"desc": "Linux base package managers"
},
{
"command": "flatpak update",
"desc": "Flathub extra sandboxed applications"
},
{
"command": "npm update -g",
"desc": "Npm installed packages on system"
},
{
"command": "pipx upgrade-all",
"desc": "Pip installed packages on system"
}
],
"other installs": [
{
"command": "glow",
"desc": "Terminal Markdown Renderer"
},
{
"command": "markserv .",
"desc": "Serve a webserver with rendered Markdown"
},
{
"command": "pinta",
"desc": "Image editor"
},
{
"command": "bottles",
"desc": "Wine wrapper"
},
{
"command": "zathura",
"desc": "PDF File viewer"
},
{
"command": "sqlitebrowser",
"desc": "SQL File browser"
},
{
"command": "lact",
"desc": "GPU Overclock Utility"
},
{
"command": "baobab",
"desc": "Directory usage analysis"
},
{
"command": "gsmartcontrol",
"desc": "Disk S.M.A.R.T analysis"
},
{
"command": "pavucontrol",
"desc": "Audio Control"
},
{
"command": "pdfunite file.pdf file.pdf united.pdf",
"desc": "Unite multiple pdf files into one"
},
{
"command": "qpdf --password='' --decrypt encrypted_file.pdf decrypted_file.pdf",
"desc": "Decrypt (or encrypt with --encrypt) a pdf file"
}
]
}