mirror of
https://gitlab.com/EternalWanderer/sheet-parser.git
synced 2024-11-29 05:23:49 +01:00
First steps towards package
This commit is contained in:
parent
c6df11bcc5
commit
a22ba4db06
26
APKBUILD
Normal file
26
APKBUILD
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Contributor: Marty Sluijtman <marty.wanderer@disroot.org>
|
||||||
|
# Maintainer: Marty Sluijtman <marty.wanderer@disroot.org>
|
||||||
|
pkgname=sheet-parser
|
||||||
|
pkgver=0.1
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="A little D&D character sheet parser written in go"
|
||||||
|
url="https://gitlab.com/EternalWanderer/sheet-parser"
|
||||||
|
arch="all"
|
||||||
|
license="GPL-3.0"
|
||||||
|
makedepends="go"
|
||||||
|
subpackages="$pkgname-doc
|
||||||
|
$pkgname-zsh-completion
|
||||||
|
"
|
||||||
|
source="https://alpine.voidcruiser.nl/src/$pkgname-$pkgver.tar.gz"
|
||||||
|
options="!check"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
make install PREFIX=/usr DESTDIR="$pkgdir"
|
||||||
|
install -D -m 644 misc/auto-completion/zsh/_nnn \
|
||||||
|
"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
|
||||||
|
}
|
||||||
|
|
46
Makefile
Normal file
46
Makefile
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
VERSION = 0.1
|
||||||
|
PREFIX = /usr/local
|
||||||
|
MANPREFIX = $(PREFIX)/share/man
|
||||||
|
ZSH_COMPLETION_OUTPUT := zsh.completion
|
||||||
|
|
||||||
|
SRC = main.go go.mod sheetContent.go
|
||||||
|
|
||||||
|
all: sheet-parser
|
||||||
|
|
||||||
|
sheet-parser:
|
||||||
|
go build -o sheet-parser -buildvcs=false
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f sheet-parser sheet-parser-$(VERSION).tar.gz
|
||||||
|
|
||||||
|
dist: clean
|
||||||
|
mkdir -p sheet-parser-$(VERSION)
|
||||||
|
cp -R LICENSE Makefile README.md sheet-parser.1 $(SRC) sheet-parser-$(VERSION)
|
||||||
|
tar -cf sheet-parser-$(VERSION).tar sheet-parser-$(VERSION)
|
||||||
|
gzip sheet-parser-$(VERSION).tar
|
||||||
|
rm -rf sheet-parser-$(VERSION)
|
||||||
|
|
||||||
|
install: all
|
||||||
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
|
cp -f sheet-parser $(DESTDIR)$(PREFIX)/bin
|
||||||
|
chmod 775 $(DESTDIR)$(PREFIX)/bin/sheet-parser
|
||||||
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||||
|
cat sheet-parser.1 > $(DESTDIR)$(MANPREFIX)/man1/sheet-parser.1
|
||||||
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sheet-parser.1
|
||||||
|
|
||||||
|
install-completions:
|
||||||
|
@install -d $(DESTDIR)$(PREFIX)/share/zsh/site-functions
|
||||||
|
@install -m 0644 $(ZSH_COMPLETION_OUTPUT) $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_sheet-parser
|
||||||
|
@printf '%s\n' '$(OK)'
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(PREFIX)/bin/sheet-parser\
|
||||||
|
$(DESTDIR)$(MANPREFIX)/man1/sheet-parser.1
|
||||||
|
|
||||||
|
package: dist
|
||||||
|
rsync --progress sheet-parser-$(VERSION).tar.gz voidDroplet:/var/www/alpine/src/
|
||||||
|
rm -f /var/cache/distfiles/sheet-parser*
|
||||||
|
abuild checksum
|
||||||
|
abuild -r
|
||||||
|
|
||||||
|
.PHONY: all sheet-parser clean dist install uninstall package
|
48
sheet-parser.1
Normal file
48
sheet-parser.1
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
.TH SHEET-PARSER 1
|
||||||
|
.SH NAME
|
||||||
|
sheet-parser \- D&D sheet parser utility written in go
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B dice-roller
|
||||||
|
.OP -a
|
||||||
|
.OP -s
|
||||||
|
.OP -c
|
||||||
|
.OP -m
|
||||||
|
.PP
|
||||||
|
.B dice-roller
|
||||||
|
.OP --advantage
|
||||||
|
.PP
|
||||||
|
.B dice-roller
|
||||||
|
.OP --disadvantage
|
||||||
|
.PP
|
||||||
|
.B dice-roller
|
||||||
|
.OP --coin
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B sheet-parser
|
||||||
|
is a little utility written with the purpose of being able to parse 5e D&D sheets.
|
||||||
|
Digging through all the different stats and skills and keeping track of their modifiers got a rather tiresome after a while.
|
||||||
|
|
||||||
|
This thing makes use of some of the functionality of
|
||||||
|
.B dice-roller,
|
||||||
|
mainly the way it deals with advantage and disadvantage.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B -a --attacks
|
||||||
|
Roll a set rules multiple times, does not apply to advantage and disadvantage, defaults to 1.
|
||||||
|
.TP
|
||||||
|
.B -s --surfaces
|
||||||
|
Use to specify die surfaces, does not apply to advantage and disadvantage, defaults to 20.
|
||||||
|
.TP
|
||||||
|
.B -c --throws
|
||||||
|
Specify amount of dice to cast
|
||||||
|
.TP
|
||||||
|
.B -m --modifier
|
||||||
|
Add modifier to result of rolls
|
||||||
|
.TP
|
||||||
|
.B --advantage
|
||||||
|
Roll two 2d20 and take the highest number, accepts modifiers
|
||||||
|
.TP
|
||||||
|
.B --disadvantage
|
||||||
|
Roll two 2d20 and take the lowest number, accepts modifiers
|
||||||
|
.TP
|
||||||
|
.B --coin
|
||||||
|
Toss a coin, same behaviour as throwing with 2 surfaces, only accepts different amount of casts.
|
341
zsh.completion
Normal file
341
zsh.completion
Normal file
|
@ -0,0 +1,341 @@
|
||||||
|
#compdef sheet-parser
|
||||||
|
|
||||||
|
_sheet-parser () {
|
||||||
|
local cmd
|
||||||
|
if (( CURRENT > 2)); then
|
||||||
|
cmd=${words[2]}
|
||||||
|
curcontext="${curcontext%:*:*}:gopass-$cmd"
|
||||||
|
(( CURRENT-- ))
|
||||||
|
shift words
|
||||||
|
case "${cmd}" in
|
||||||
|
age)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"identities:List identities"
|
||||||
|
)
|
||||||
|
_describe -t commands "gopass age" subcommands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
alias)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"add:Add a new alias"
|
||||||
|
"remove:Remove an alias from a domain"
|
||||||
|
"delete:Delete an entire domain"
|
||||||
|
)
|
||||||
|
_describe -t commands "gopass alias" subcommands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
audit)
|
||||||
|
_arguments : "--expiry[Age in days before a password is considered expired. Setting this will only check expiration.]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
cat)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
clone)
|
||||||
|
_arguments : "--path[Path to clone the repo to]" "--crypto[Select crypto backend \[age gpgcli plain\]]" "--storage[Select storage backend \[fossilfs gitfs\]]" "--check-keys[Check for valid decryption keys. Generate new keys if none are found.]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
completion)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"bash:Source for auto completion in bash"
|
||||||
|
"zsh:Source for auto completion in zsh"
|
||||||
|
"fish:Source for auto completion in fish"
|
||||||
|
"openbsdksh:Source for auto completion in OpenBSD's ksh"
|
||||||
|
)
|
||||||
|
_describe -t commands "gopass completion" subcommands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
config)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
convert)
|
||||||
|
_arguments : "--store[Specify which store to convert]" "--move[Replace store?]" "--crypto[Which crypto backend? \[age gpgcli plain\]]" "--storage[Which storage backend? \[fossilfs fs gitfs\]]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
copy|cp)
|
||||||
|
_arguments : "--force[Force to copy the secret and overwrite existing one]"
|
||||||
|
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
create|new)
|
||||||
|
_arguments : "--store[Which store to use]" "--force[Force path selection]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
delete|remove|rm)
|
||||||
|
_arguments : "--recursive[Recursive delete files and folders]" "--force[Force to delete the secret]"
|
||||||
|
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
edit|set)
|
||||||
|
_arguments : "--editor[Use this editor binary]" "--create[Create a new secret if none found]"
|
||||||
|
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
env)
|
||||||
|
_arguments : "--keep-case[Do not capitalize the environment variable and instead retain the original capitalization]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
find|search)
|
||||||
|
_arguments : "--clip[Copy the password into the clipboard]" "--unsafe[In the case of an exact match, display the password even if safecontent is enabled]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
fsck)
|
||||||
|
_arguments : "--decrypt[Decrypt and reencryt during fsck.
|
||||||
|
WARNING: This will update the secret content to the latest format. This might be incompatible with other implementations. Use with caution!]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
fscopy)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
fsmove)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
generate)
|
||||||
|
_arguments : "--clip[Copy the generated password to the clipboard]" "--print[Print the generated password to the terminal]" "--force[Force to overwrite existing password]" "--edit[Open secret for editing after generating a password]" "--symbols[Use symbols in the password]" "--generator[Choose a password generator, use one of: cryptic, memorable, xkcd or external. Default: cryptic]" "--strict[Require strict character class rules]" "--sep[Word separator for generated passwords. If no separator is specified, the words are combined without spaces/separator and the first character of words is capitalised.]" "--lang[Language to generate password from, currently only en (english, default) is supported]"
|
||||||
|
_gopass_complete_folders
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
git)
|
||||||
|
_arguments : "--store[Store to operate on]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
grep)
|
||||||
|
_arguments : "--regexp[Interpret pattern as RE2 regular expression]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
history|hist)
|
||||||
|
_arguments : "--password[Include passwords in output]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
init)
|
||||||
|
_arguments : "--path[Set the sub-store path to operate on]" "--store[Set the name of the sub-store]" "--crypto[Select crypto backend \[age gpgcli plain\]]" "--storage[Select storage backend \[fossilfs fs gitfs\]]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
insert)
|
||||||
|
_arguments : "--echo[Display secret while typing]" "--multiline[Insert using $EDITOR]" "--force[Overwrite any existing secret and do not prompt to confirm recipients]" "--append[Append data read from STDIN to existing data]"
|
||||||
|
_gopass_complete_folders
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
link|ln|symlink)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
list|ls)
|
||||||
|
_arguments : "--limit[Display no more than this many levels of the tree]" "--flat[Print a flat list]" "--folders[Print a flat list of folders]" "--strip-prefix[Strip this prefix from filtered entries]"
|
||||||
|
_gopass_complete_folders
|
||||||
|
|
||||||
|
;;
|
||||||
|
merge)
|
||||||
|
_arguments : "--delete[Remove merged entries]" "--force[Skip editor, merge entries unattended]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
mounts)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"add:Mount a password store"
|
||||||
|
"remove:Umount an mounted password store"
|
||||||
|
)
|
||||||
|
_describe -t commands "gopass mounts" subcommands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
move|mv)
|
||||||
|
_arguments : "--force[Force to move the secret and overwrite existing one]"
|
||||||
|
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
otp|totp|hotp)
|
||||||
|
_arguments : "--clip[Copy the time-based token into the clipboard]" "--qr[Write QR code to FILE]" "--password[Only display the token]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
process)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
pwgen)
|
||||||
|
_arguments : "--no-numerals[Do not include numerals in the generated passwords.]" "--no-capitalize[Do not include capital letter in the generated passwords.]" "--ambiguous[Do not include characters that could be easily confused with each other, like '1' and 'l' or '0' and 'O']" "--symbols[Include at least one symbol in the password.]" "--one-per-line[Print one password per line]" "--xkcd[Use multiple random english words combined to a password. By default, space is used as separator and all words are lowercase]" "--sep[Word separator for generated xkcd style password. If no separator is specified, the words are combined without spaces/separator and the first character of words is capitalised. This flag implies -xkcd]" "--lang[Language to generate password from, currently only en (english, default) is supported]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
rcs)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"init:Init RCS repo"
|
||||||
|
"status:RCS status"
|
||||||
|
)
|
||||||
|
_describe -t commands "gopass rcs" subcommands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
recipients)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"add:Add any number of Recipients to any store"
|
||||||
|
"remove:Remove any number of Recipients from any store"
|
||||||
|
)
|
||||||
|
_describe -t commands "gopass recipients" subcommands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
setup)
|
||||||
|
_arguments : "--remote[URL to a git remote, will attempt to join this team]" "--alias[Local mount point for the given remote]" "--create[Create a new team (default: false, i.e. join an existing team)]" "--name[Firstname and Lastname for unattended GPG key generation]" "--email[EMail for unattended GPG key generation]" "--crypto[Select crypto backend \[age gpgcli plain\]]" "--storage[Select storage backend \[fossilfs fs gitfs\]]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
show)
|
||||||
|
_arguments : "--yes[Always answer yes to yes/no questions]" "--clip[Copy the password value into the clipboard]" "--alsoclip[Copy the password and show everything]" "--qr[Print the password as a QR Code]" "--unsafe[Display unsafe content (e.g. the password) even if safecontent is enabled]" "--password[Display only the password. Takes precedence over all other flags.]" "--revision[Show a past revision. Does NOT support RCS specific shortcuts. Use exact revision or -<N> to select the Nth oldest revision of this entry.]" "--noparsing[Do not parse the output.]" "--chars[Print specific characters from the secret]"
|
||||||
|
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
sum|sha|sha256)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
sync)
|
||||||
|
_arguments : "--store[Select the store to sync]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
templates)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"show:Show a secret template."
|
||||||
|
"edit:Edit secret templates."
|
||||||
|
"remove:Remove secret templates."
|
||||||
|
)
|
||||||
|
_describe -t commands "gopass templates" subcommands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
unclip)
|
||||||
|
_arguments : "--timeout[Time to wait]" "--force[Clear clipboard even if checksum mismatches]"
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
update)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
version)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
help|h)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_gopass_complete_passwords
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"age:age commands"
|
||||||
|
"alias:Manage domain aliases"
|
||||||
|
"audit:Decrypt all secrets and scan for weak or leaked passwords"
|
||||||
|
"cat:Decode and print content of a binary secret to stdout, or encode and insert from stdin"
|
||||||
|
"clone:Clone a password store from a git repository"
|
||||||
|
"completion:Bash and ZSH completion"
|
||||||
|
"config:Display and edit the configuration file"
|
||||||
|
"convert:Convert a store to different backends"
|
||||||
|
"copy:Copy secrets from one location to another"
|
||||||
|
"create:Easy creation of new secrets"
|
||||||
|
"delete:Remove one or many secrets from the store"
|
||||||
|
"edit:Edit new or existing secrets"
|
||||||
|
"env:Run a subprocess with a pre-populated environment"
|
||||||
|
"find:Search for secrets"
|
||||||
|
"fsck:Check store integrity"
|
||||||
|
"fscopy:Copy files from or to the password store"
|
||||||
|
"fsmove:Move files from or to the password store"
|
||||||
|
"generate:Generate a new password"
|
||||||
|
"git:Run a git command inside a password store: gopass git [--store=<store>] <git-command>"
|
||||||
|
"grep:Search for secrets files containing search-string when decrypted."
|
||||||
|
"history:Show password history"
|
||||||
|
"init:Initialize new password store."
|
||||||
|
"insert:Insert a new secret"
|
||||||
|
"link:Create a symlink"
|
||||||
|
"list:List existing secrets"
|
||||||
|
"merge:Merge multiple secrets into one"
|
||||||
|
"mounts:Edit mounted stores"
|
||||||
|
"move:Move secrets from one location to another"
|
||||||
|
"otp:Generate time- or hmac-based tokens"
|
||||||
|
"process:Process a template file"
|
||||||
|
"pwgen:Generate passwords"
|
||||||
|
"rcs:Run a RCS command inside a password store"
|
||||||
|
"recipients:Edit recipient permissions"
|
||||||
|
"setup:Initialize a new password store"
|
||||||
|
"show:Display the content of a secret"
|
||||||
|
"sum:Compute the SHA256 checksum"
|
||||||
|
"sync:Sync all local stores with their remotes"
|
||||||
|
"templates:Edit templates"
|
||||||
|
"unclip:Internal command to clear clipboard"
|
||||||
|
"update:Check for updates"
|
||||||
|
"version:Display version"
|
||||||
|
"help:Shows a list of commands or help for one command"
|
||||||
|
)
|
||||||
|
_describe -t command 'gopass' subcommands
|
||||||
|
_arguments : "--yes[Always answer yes to yes/no questions]" "--clip[Copy the password value into the clipboard]" "--alsoclip[Copy the password and show everything]" "--qr[Print the password as a QR Code]" "--unsafe[Display unsafe content (e.g. the password) even if safecontent is enabled]" "--password[Display only the password. Takes precedence over all other flags.]" "--revision[Show a past revision. Does NOT support RCS specific shortcuts. Use exact revision or -<N> to select the Nth oldest revision of this entry.]" "--noparsing[Do not parse the output.]" "--chars[Print specific characters from the secret]" "--help[show help]" "--version[print the version]"
|
||||||
|
_gopass_complete_passwords
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_gopass_complete_keys () {
|
||||||
|
local IFS=$'\n'
|
||||||
|
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons 2> /dev/null | cut -d : -f 10 | sort -u | sed '/^$/d')
|
||||||
|
}
|
||||||
|
|
||||||
|
_gopass_complete_passwords () {
|
||||||
|
local IFS=$'\n'
|
||||||
|
_arguments : \
|
||||||
|
"--clip[Copy the first line of the secret into the clipboard]"
|
||||||
|
_values 'passwords' $(gopass ls --flat)
|
||||||
|
}
|
||||||
|
|
||||||
|
_gopass_complete_folders () {
|
||||||
|
local -a folders
|
||||||
|
folders=("${(@f)$(gopass ls --folders --flat)}")
|
||||||
|
_describe -t folders "folders" folders -qS /
|
||||||
|
}
|
||||||
|
|
||||||
|
_gopass
|
Loading…
Reference in a new issue