Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: Feat/manpages #42

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ jobs:
with:
rust-version: stable
- uses: actions/checkout@v1
- name: Build
run: ci/action.sh release ${{ matrix.target }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build
run: ci/action.sh release ${{ matrix.target }} ${{ steps.get_version.outputs.VERSION }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/tar/bombadil.tar.gz
tag: ${{ github.ref }}
asset_name: bombadil-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz
asset_name: bombadil-${{ steps.get_version.outputs.VERSION }}-${{ matrix.target }}.tar.gz
5 changes: 4 additions & 1 deletion ci/action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ echoerr() {
release() {

TAR_DIR="${BOMBADIL_HOME}/target/tar"
VERSION="$2"

target="${1:-}"
if [[ $target == *"osx"* ]]; then
Expand All @@ -30,6 +31,8 @@ release() {
bin_folder="release"
fi

."/$BOMBADIL_HOME/ci/build_manpage.sh" -i man/bombadil.1.md -o "$TAR_DIR/bombadil.1" -v "$VERSION"

bin_path="${BOMBADIL_HOME}/target/${bin_folder}/bombadil"
chmod +x "$bin_path"
mkdir -p "$TAR_DIR" 2> /dev/null || true
Expand All @@ -44,4 +47,4 @@ release() {
cmd="$1"
shift

release "$@"
release "$@"
26 changes: 26 additions & 0 deletions ci/build_manpage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail

TEMP_FILE=/tmp/bombadil_man.md
DATE=$(date +"%dth %B, %Y")

while getopts v:i:o: option
do
case "${option}"
in
v) VERSION=${OPTARG};;
i) INPUT_PATH=${OPTARG};;
o) OUTPUT_PATH=${OPTARG};;
*) echo "invalid flag"
esac
done

echo -e "Creating temporary file"
cp "$INPUT_PATH" "$TEMP_FILE"

echo -e "Setting version to $VERSION"
sed -i -e "s/{{version}}/$VERSION/g" "$TEMP_FILE"
echo -e "Setting date released to $DATE"
sed -i -e "s/{{date_released}}/$DATE/g" "$TEMP_FILE"

pandoc "$TEMP_FILE" -s -t man > "$OUTPUT_PATH"
30 changes: 30 additions & 0 deletions man/bombadil.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
% BOMBADIL(1) bombadil {{version}}
% Paul Delafosse
% {{date_released}}

# NAME

bombadil - dotfile manager written in rust.

# SYNOPSYS

**bombadil** [*COMMAND*]

# DESCRIPTION

**bombadil** blablabla

# OPTIONS

**-h** | **--help**
: Displays a friendly help message

**-V** | **--versions**
: Displays version information

# EXAMPLES

**bombadil install -c .dotfiles/bombadil.toml**
: Setup bombadi to use .dotfiles/bombadil.toml as its configuration file