Skip to content

Commit 418d06c

Browse files
authored
Initial commit
0 parents  commit 418d06c

File tree

6 files changed

+110
-0
lines changed

6 files changed

+110
-0
lines changed

.chezmoi.yaml.tmpl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- /* Checks if running interactively, which is not the case for GitHub Codespaces */ -}}
2+
{{- $interactive := stdinIsATTY -}}
3+
4+
{{- /* Initializes the name variable with a default value */ -}}
5+
{{- $name := "Your Name" -}}
6+
{{- /* If name was previously set, reuses it */ -}}
7+
{{- if hasKey . "name" -}}
8+
{{- $name = .name -}}
9+
{{- /* Otherwise, if running interactively, prompts for a name */ -}}
10+
{{- else if $interactive -}}
11+
{{- $name = promptString "name" $name -}}
12+
{{- end -}}
13+
14+
{{- /* Does the same for the email */ -}}
15+
{{- $email := "your@email.com" -}}
16+
{{- if hasKey . "email" -}}
17+
{{- $email = .email -}}
18+
{{- else if $interactive -}}
19+
{{- $email = promptString "email" $email -}}
20+
{{- end -}}
21+
22+
{{- if $interactive -}}
23+
{{- writeToStdout "💡 Tip: you can re-enter your name and email with `chezmoi init --data=false`.\n" -}}
24+
{{- end -}}
25+
26+
sourceDir: {{ .chezmoi.sourceDir | quote }}
27+
28+
data:
29+
name: {{ $name | quote }}
30+
email: {{ $email | quote }}

.chezmoiignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.github/
2+
install.sh
3+
LICENSE
4+
README.md

.github/workflows/ci.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
clone-and-install:
9+
runs-on: ubuntu-latest
10+
container:
11+
image: mcr.microsoft.com/vscode/devcontainers/base:ubuntu
12+
env:
13+
CODESPACES: true
14+
steps:
15+
- uses: actions/checkout@v2
16+
- run: ./install.sh
17+
- name: chezmoi data
18+
run: '"$HOME/.local/bin/chezmoi" data'

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Tom Payne
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# dotfiles
2+
3+
Template dotfiles repository, managed with [chezmoi](https://chezmoi.io/).
4+
5+
## License
6+
7+
MIT

install.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
# -e: exit on error
4+
# -u: exit on unset variables
5+
set -eu
6+
7+
if ! chezmoi="$(command -v chezmoi)"; then
8+
bin_dir="${HOME}/.local/bin"
9+
chezmoi="${bin_dir}/chezmoi"
10+
echo "Installing chezmoi to '${chezmoi}'" >&2
11+
if command -v curl >/dev/null; then
12+
chezmoi_install_script="$(curl -fsSL https://chezmoi.io/get)"
13+
elif command -v wget >/dev/null; then
14+
chezmoi_install_script="$(wget -qO- https://chezmoi.io/get)"
15+
else
16+
echo "To install chezmoi, you must have curl or wget installed." >&2
17+
exit 1
18+
fi
19+
sh -c "${chezmoi_install_script}" -- -b "${bin_dir}"
20+
unset chezmoi_install_script bin_dir
21+
fi
22+
23+
# POSIX way to get script's dir: https://stackoverflow.com/a/29834779/12156188
24+
script_dir="$(cd -P -- "$(dirname -- "$(command -v -- "$0")")" && pwd -P)"
25+
26+
set -- init --apply --source="${script_dir}"
27+
28+
echo "Running 'chezmoi $*'" >&2
29+
# exec: replace current process with chezmoi
30+
exec "$chezmoi" "$@"

0 commit comments

Comments
 (0)