Skip to content
Merged
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
11 changes: 10 additions & 1 deletion .aliases.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# shellcheck shell=bash
# Common aliases for Bash and Zsh
alias g='git'
alias gcm='git checkout master'
Expand All @@ -14,7 +15,15 @@ alias gc='git commit'
alias ga='git add'
alias gaa='git add .'
alias gch='git checkout'
alias grprs='t=`git describe --abbrev=0 --tags`;echo "Since $t:";echo;git log $t..origin/master --merges|grep "^ .\\+"|grep -v Merge|sed -e"s/ //g"'
grprs() {
t=$(git describe --abbrev=0 --tags)
echo "Since $t:"
echo
git log "$t"..origin/master --merges \
| grep "^ .\\+" \
| grep -v Merge \
| sed -e "s/ //g"
}
alias gst='git status'
alias d='docker'
alias dc='docker compose'
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CI

on:
pull_request:
branches: [main]
types: [opened]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run shellcheck
run: shellcheck $(git ls-files '*.sh')
- name: Test install script
env:
HOME: ${{ runner.temp }}
run: bash install.sh
18 changes: 12 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ link_to_homedir() {

# dirnameは、パスからディレクトリ部分のみを取り出す
# BASH_SOURCE[0]には実行したスクリプトのパスが入っている
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
local dotdir=$script_dir
local script_dir
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
local dotdir="$script_dir"
if [[ "$HOME" != "$dotdir" ]];then
# ?: 任意の一文字にマッチ
# *: 長さ0以上の文字列にマッチ
for f in "$dotdir"/.??* "$dotdir"/Taskfile.base.yml; do
local filename=$(basename $f)
local filename
filename=$(basename "$f")
# -L: ファイルが存在し、シンボリックリンクであれば真
if [[ -L "$HOME/$filename" ]];then
command rm -f "$HOME/$filename"
Expand All @@ -33,7 +35,7 @@ link_to_homedir() {
# -s: ハードリンクではなく、シンボリックリンクを作る
# -n: リンクの作成場所として指定したディレクトリがシンボリックリンクだった場合、参照先にリンクを作るのではなく、シンボリックリンクそのものを置き換える(-fと組み合わせて使用)
# -f: 同じ名前のファイルがあっても強制的に上書き
command ln -snf $f $HOME
command ln -snf "$f" "$HOME"
done

if [ ! -f "$HOME/Taskfile.yml" ];then
Expand All @@ -48,9 +50,13 @@ link_to_homedir() {

update_preference() {
if [[ "$SHELL" == "/bin/bash" ]];then
command source "$HOME/.bashrc"
set +u
command source "$HOME/.bashrc" || true
set -u
elif [[ "$SHELL" == "/bin/zsh" ]];then
command zsh -c "source $HOME/.zshrc"
set +u
command zsh -c "source \"$HOME/.zshrc\"" || true
set -u
else
command echo "unknown shell"
fi
Expand Down