mirror of https://github.com/curusarn/resh
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.8 KiB
89 lines
2.8 KiB
SHELL=/bin/bash
|
|
LATEST_TAG=$(shell git describe --tags)
|
|
REVISION=$(shell [ -z "$(git status --untracked-files=no --porcelain)" ] && git rev-parse --short=12 HEAD || echo "no_revision")
|
|
VERSION=${LATEST_TAG}-dev-${REVISION}
|
|
GOFLAGS=-ldflags "-X main.version=${VERSION} -X main.commit=${REVISION}"
|
|
|
|
sanitize:
|
|
#
|
|
#
|
|
# I'm going to create a sanitized version of your resh history.
|
|
# Everything is done locally - your history won't leave this machine.
|
|
# The way this works is that any sensitive information in your history is going to be replaced with its SHA1 hash.
|
|
# There is also going to be a second version with hashes trimed to 12 characters for readability
|
|
#
|
|
#
|
|
# > full hashes: ~/resh_history_sanitized.json
|
|
# > 12 char hashes: ~/resh_history_sanitized_trim12.json
|
|
#
|
|
#
|
|
# Encountered any issues? Got questions? -> Hit me up at https://github.com/curusarn/resh/issues
|
|
#
|
|
#
|
|
# Running history sanitization ...
|
|
resh-sanitize -trim-hashes 0 --output ~/resh_history_sanitized.json
|
|
resh-sanitize -trim-hashes 12 --output ~/resh_history_sanitized_trim12.json
|
|
#
|
|
#
|
|
# SUCCESS - ALL DONE!
|
|
#
|
|
#
|
|
# PLEASE HAVE A LOOK AT THE RESULT USING THESE COMMANDS:
|
|
#
|
|
# > pretty print JSON:
|
|
@echo 'cat ~/resh_history_sanitized_trim12.json | jq'
|
|
#
|
|
# > only show executed commands, don't show metadata:
|
|
@echo "cat ~/resh_history_sanitized_trim12.json | jq '.[\"cmdLine\"]'"
|
|
#
|
|
#
|
|
#
|
|
|
|
build: submodules bin/resh-session-init bin/resh-collect bin/resh-postcollect bin/resh-daemon\
|
|
bin/resh-evaluate bin/resh-sanitize bin/resh-control bin/resh-config bin/resh-inspect
|
|
|
|
install: build
|
|
scripts/install.sh
|
|
|
|
test_go:
|
|
# Running tests
|
|
@for dir in {cmd,pkg}/* ; do \
|
|
echo $$dir ; \
|
|
go test $$dir/*.go ; \
|
|
done
|
|
|
|
test: test_go
|
|
scripts/test.sh
|
|
|
|
rebuild:
|
|
make clean
|
|
make build
|
|
|
|
clean:
|
|
rm bin/resh-*
|
|
|
|
uninstall:
|
|
# Uninstalling ...
|
|
-rm -rf ~/.resh/
|
|
|
|
bin/resh-%: cmd/%/*.go pkg/*/*.go cmd/control/cmd/*.go cmd/control/status/status.go
|
|
go build ${GOFLAGS} -o $@ cmd/$*/*.go
|
|
|
|
.PHONY: ser submodules build install rebuild uninstall clean
|
|
|
|
|
|
submodules: | submodules/bash-preexec/bash-preexec.sh submodules/bash-zsh-compat-widgets/bindfunc.sh
|
|
@# sets submodule.recurse to true if unset
|
|
@# sets status.submoduleSummary to true if unset
|
|
@git config --get submodule.recurse >/dev/null || git config --global submodule.recurse true
|
|
@#git config --get status.submoduleSummary >/dev/null || git config --global status.submoduleSummary true
|
|
@#git config --get diff.submodule >/dev/null || git config --global diff.submodule log
|
|
@# warns user if submodule.recurse is not set to true
|
|
@[[ "true" == `git config --get submodule.recurse` ]] || echo "WARN: You should REALLY set 'git config --global submodule.recurse true'!"
|
|
@#git config --global push.recurseSubmodules check
|
|
|
|
submodules/%:
|
|
# Getting submodules ...
|
|
git submodule sync --recursive
|
|
git submodule update --init --recursive
|
|
|
|
|