Skip to content

Commit 6b773e1

Browse files
committed
Merge MR 'feat(fish): add wrapper around mkdir and cd' into 'main'
See merge request el-capitano/dotfiles!514
2 parents 8b01b03 + e991ac1 commit 6b773e1

File tree

6 files changed

+58
-32
lines changed

6 files changed

+58
-32
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
function benchmark \
2-
--description 'benchmark a shell' \
3-
--argument-names shellname
2+
--description 'benchmark a shell' \
3+
--argument-names shellname
44

5-
test -n "$shellname" || set shellname fish
6-
echo "running $shellname 10 times..."
7-
for i in (seq 10)
8-
/usr/bin/time -f "\t%E real,\t%U user,\t%S sys" $shellname -i -c exit
9-
end
5+
test -n "$shellname" || set shellname fish
6+
echo "running $shellname 10 times..."
7+
for i in (seq 10)
8+
/usr/bin/time -f "\t%E real,\t%U user,\t%S sys" $shellname -i -c exit
9+
end
1010
end
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Function to check if a git repository has pending changes
22
function check_git_status
3-
find . -type d -name ".git" ! -path "*/.terraform/modules*" -exec dirname {} \; | while read -l dir
4-
if test -d "$dir/.git"
5-
pushd "$dir" > /dev/null; or return
6-
if git status --porcelain | grep -q .
7-
echo "=== Pending changes in $dir ==="
8-
git status -s
9-
end
10-
popd > /dev/null; or return
11-
end
12-
end
3+
find . -type d -name ".git" ! -path "*/.terraform/modules*" -exec dirname {} \; | while read -l dir
4+
if test -d "$dir/.git"
5+
pushd "$dir" >/dev/null; or return
6+
if git status --porcelain | grep -q .
7+
echo "=== Pending changes in $dir ==="
8+
git status -s
9+
end
10+
popd >/dev/null; or return
11+
end
12+
end
1313
end
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
# set -g gl_runner_optspec 'b/backend=' no-plan
22

33
function gl_runner --description 'Manage the Hetzner Cloud Runner.'
4-
set -l up_schedule_id '2691862'
5-
set -l down_schedule_id '383558'
6-
set -l project_path 'el-capitano/operations/hetzner-cloud-runners'
4+
set -l up_schedule_id 2691862
5+
set -l down_schedule_id 383558
6+
set -l project_path el-capitano/operations/hetzner-cloud-runners
77

88
if test -z $argv
9-
echo "No command given: set either 'up' or 'down'"
10-
return 1
9+
echo "No command given: set either 'up' or 'down'"
10+
return 1
1111
end
1212

1313
set -l action $argv[1]
1414

15-
if test $action = "up"
16-
echo "Starting runner..."
17-
glab -R $project_path schedule run $up_schedule_id
18-
else if test $action = "down"
19-
echo "Stopping runner..."
20-
glab -R $project_path schedule run $down_schedule_id
15+
if test $action = up
16+
echo "Starting runner..."
17+
glab -R $project_path schedule run $up_schedule_id
18+
else if test $action = down
19+
echo "Stopping runner..."
20+
glab -R $project_path schedule run $down_schedule_id
2121

2222
else
23-
echo "Unknown command, set either 'up' or 'down'"
24-
return 1
23+
echo "Unknown command, set either 'up' or 'down'"
24+
return 1
2525
end
2626

27-
2827
sleep 5 # Pipeline creation is async, so we wait...
2928
glab -R $project_path ci status -b main --live --compact
3029
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function mkd -a dir --description "Create a dir at path and navigate to it."
2+
set -l dir $argv[1]
3+
if test -z $dir
4+
echo "Usage: mkd <dir>"
5+
return 1
6+
else if test -d $dir
7+
echo "$dir already exists, entering it"
8+
cd $dir
9+
return 0
10+
else if test -e $dir
11+
echo "$dir exists but is not a directory"
12+
return 2
13+
end
14+
15+
mkdir -p $dir && cd $dir
16+
end

chezmoi/dot_config/fish/functions/weather.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function weather --description 'What is the weather?' -a location
22
if test -z "$location"
3-
set location "almere"
3+
set location almere
44
end
55
set location (string escape --style=url "$location")
66
set url "http://wttr.in/$location?QF&lang=nl"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#MISE dir="{{cwd}}"
3+
#MISE description="Sets up selected Python with venv"
4+
#USAGE arg "<version>" help="Python version to use"
5+
#USAGE complete "version" run=#"mise ls-remote python | grep -oP '^\d+\.\d+\.\d+$'"#
6+
7+
mise use python@$usage_version
8+
mise use pre-commit
9+
mise config set env._.python.venv.path .venv
10+
mise config set env._.python.venv.create true -t bool
11+
mise config set tasks.lint.run "pre-commit run -a"

0 commit comments

Comments
 (0)