6 Commits

6 changed files with 117 additions and 4 deletions

4
.prettierrc Normal file
View File

@@ -0,0 +1,4 @@
{
"proseWrap": "always"
"printWidth": 100
}

View File

@@ -1,2 +0,0 @@
proseWrap: always
printWidth: 120

View File

@@ -154,7 +154,7 @@ mkdir $HOME/Pictures >/dev/null 2>&1
mkdir -p $XDG_DATA_HOME/clipse/tmp_files
copy $DEV_ENV/dev-env $HOME/.local/scripts/dev-env
copy $DEV_ENV/env/.markdownlint.jsonc $HOME/.markdownlint.jsonc
copy $DEV_ENV/env/.prettierrc.yaml $HOME/.prettierrc.yaml
copy $DEV_ENV/env/.prettierrc $HOME/.prettierrc
mkdir -p $XDG_DATA_HOME/applications/icons
copy_files $DEV_ENV/env/.local/share/applications $XDG_DATA_HOME/applications

View File

@@ -30,6 +30,7 @@
default = simple
autoSetupRemote = true
followTags = true
recurseSubmodules = on-demand
[fetch]
prune = true
@@ -65,3 +66,6 @@
autoSquash = true
autoStash = true
updateRefs = true
[submodule]
recurse = true

107
env/.local/scripts/swift-dev vendored Executable file
View File

@@ -0,0 +1,107 @@
#!/usr/bin/env bash
set -e
set -o nounset
set -o pipefail
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
THIS_FILE=${BASH_SOURCE[0]}
LOG_LABEL=$(basename "$THIS_FILE")
THIS=${THIS:-$LOG_LABEL}
LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
IMAGE="git.housh.dev/michael/swift-dev-container"
IMAGE_TAG="latest"
declare cmd dir pull_flag run_flag
cmd=""
dir=""
pull_flag="0"
run_flag="1"
usage() {
cat <<EOF
Runs neovim inside swift-dev-container docker container for working on swift projects.
Currently I'm unable to get swift to install on arch linux, so this gives me working lsp, etc.
USAGE:
$ $THIS <flags> <command> -- <docker comand>
FLAGS:
-h | --help: Show this help page.
-p | --pull: Used with run command, to pull/update image before running.
-t | --tag <tag>: Used with run command to specify the image tag to use.
COMMANDS:
pull <tag>: Pull the dev container image, tag is optional (default; 'latest').
run <dir> (default): Run the dev container in the directory, if directory not supplied it
will default to PWD.
NOTES:
Run command is implied / default, so it's not required to be passed if you just want to run the
container. For example in your swift project directory you can run 'swift-dev' and a container
will start.
This will properly mount '~/.config/nvim' and '~/.local/share/nvim' inside the container.
If you would like to run a custom command / not run neovim in the container then it MUST follow
'--'. For example, 'swift-dev -- /bin/bash'.
EOF
}
# Logging utility function, use in place of echo.
log() {
logging log --source "$THIS_FILE" "$@"
}
pull() {
log "Pulling image: '$IMAGE:$IMAGE_TAG'"
podman pull "$IMAGE:$IMAGE_TAG"
}
run() {
[[ -z $dir ]] && dir="$PWD"
[[ -z $cmd ]] && cmd="/root/.local/share/bob/nvim-bin/nvim"
log "Running '$IMAGE:$IMAGE_TAG', in: '$dir'"
podman run -it --rm \
--volume "$XDG_CONFIG_HOME/nvim":/root/.config/nvim \
--volume "$XDG_DATA_HOME/nvim":/root/.local/share/nvim \
--volume "$dir":/root/dev \
"$IMAGE:$IMAGE_TAG" "$cmd"
}
################################################################################
# MAIN
################################################################################
# Setup logging file and label.
source "$SCRIPTS/hypr/logging"
setup-logging "$LOG_FILE" "$LOG_LABEL"
while [[ $# -gt 0 ]]; do
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
usage && exit 0
elif [[ $1 == "-p" ]] || [[ $1 == "--pull" ]]; then
pull_flag="1"
elif [[ $1 == "-t" ]] || [[ $1 == "--tag" ]]; then
[[ -n ${2:-""} ]] || (log --error "Must supply a tag" && exit 1)
IMAGE_TAG=$2
shift
elif [[ $1 == "pull" ]]; then
run_flag="0"
pull_flag="1"
elif [[ $1 == "--" ]]; then
shift
cmd="$*"
elif [[ ! $1 == "run" ]]; then
dir="$1"
fi
shift
done
[[ $pull_flag = "1" ]] && pull
[[ $run_flag = "1" ]] && run