Many updates and improvements

- yamllint
- shfmt config
- fix Go bin path
- fix git credentials config
- add nvm default packages
- updated Brewfile
This commit is contained in:
Ismo Vuorinen
2023-03-28 15:27:44 +03:00
parent 6395895beb
commit bb3f4a8f6c
32 changed files with 189 additions and 103 deletions

View File

@@ -11,9 +11,24 @@ trim_trailing_whitespace = true
[*.lua]
insert_final_newline = true
[*.yaml,*.yml]
[*.yaml]
indent_size = 2
insert_final_newline = true
[*.yml]
indent_size = 2
insert_final_newline = true
[*.sh]
indent_size = 2
indent_style = space
insert_final_newline = true
shell_variant = bash # --language-variant
binary_next_line = true
switch_case_indent = true # --case-indent
space_redirects = false
keep_padding = false
function_next_line = true # --func-next-line
[local/bin/antigen.zsh]
ignore = true

View File

@@ -1,30 +1,26 @@
name: reviewdog
on: [ push ]
on: [push]
jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: GitHub Actions
uses: reviewdog/action-actionlint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
- name: detect-secrets
uses: reviewdog/action-detect-secrets@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
- name: markdownlint
uses: reviewdog/action-markdownlint@v0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
- name: shfmt
uses: reviewdog/action-shfmt@v1
with:

3
.gitignore vendored
View File

@@ -1,3 +1,6 @@
Brewfile.lock.json
*.log
*-secret
.idea
.vscode

1
.python-version Normal file
View File

@@ -0,0 +1 @@
3

25
.yamlfmt Normal file
View File

@@ -0,0 +1,25 @@
formatter:
type: basic
indent: 2
retain_line_breaks: false
disallow_anchors: false
max_line_length: 0
scan_folded_as_literal: false
indentless_arrays: false
doublestar: true
extensions:
- yaml
- yml
include:
- ./*.{yml,yaml}
- ./**/*.{yml,yaml}
exclude:
- ./dotbot/**
- ./dotbot-*/**
- ./config/astronvim/**
- ./config/nvim/**

View File

@@ -10,12 +10,17 @@ tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "homebrew/services"
tap "jesseduffield/lazygit"
tap "mongodb/brew"
tap "shivammathur/extensions"
tap "shivammathur/php"
tap "teamookla/speedtest"
# Interpreted, interactive, object-oriented programming language
brew "python@3.11"
# Automate deployment, configuration, and upgrading
brew "ansible"
# Checks ansible playbooks for practices and behaviour
brew "ansible-lint"
# Zstandard is a real-time compression algorithm
brew "zstd"
# Spell checker with better logic than ispell
@@ -26,6 +31,8 @@ brew "autoconf"
brew "awscli"
# Terminal bandwidth utilization tool
brew "bandwhich"
# Yet another cross-platform graphical process/system monitor
brew "bottom"
# Switch Apache / Valet / CLI configs between PHP versions
brew "brew-php-switcher"
# Core application library for C
@@ -34,30 +41,22 @@ brew "glib"
brew "pkg-config"
# Cross-platform make
brew "cmake"
# Open source suite of directory software
brew "openldap"
# Get a file from an HTTP, HTTPS or FTP server
brew "curl"
# Libraries to talk to Microsoft SQL Server and Sybase databases
brew "freetds"
# C/C++ and Java libraries for Unicode and globalization
brew "icu4c"
# Postgres C API library
brew "libpq"
# General-purpose scripting language
brew "php"
# Dependency Manager for PHP
brew "composer"
# GNU File, Shell, and Text utilities
brew "coreutils"
# Get, unpack, build, and install modules from CPAN
brew "cpanminus"
# Open source suite of directory software
brew "openldap"
# Get a file from an HTTP, HTTPS or FTP server
brew "curl"
# Diff that understands syntax
brew "difftastic"
# Tool for exploring each layer in a docker image
brew "dive"
# Command-line DNS client
brew "dog"
# Lightning-fast linter for .env files written in Rust
brew "dotenv-linter"
# Tool to verify that your files are in harmony with your .editorconfig
brew "editorconfig-checker"
# Useful examples at the command-line
@@ -66,8 +65,12 @@ brew "eg-examples"
brew "faas-cli"
# Simple, fast and user-friendly alternative to find
brew "fd"
# Libraries to talk to Microsoft SQL Server and Sybase databases
brew "freetds"
# Monitor a directory for changes and run a shell command
brew "fswatch"
# Disk usage analyzer with console interface written in Go
brew "gdu", link: false
# GitHub command-line tool
brew "gh"
# Distributed revision control system
@@ -92,6 +95,8 @@ brew "gnupg"
brew "go"
# Image manipulation
brew "netpbm"
# C/C++ and Java libraries for Unicode and globalization
brew "icu4c"
# OpenType text shaping engine
brew "harfbuzz"
# Library to render SVG files using Cairo
@@ -114,6 +119,8 @@ brew "imagemagick"
brew "jq"
# Lazier way to manage everything docker
brew "lazydocker"
# Postgres C API library
brew "libpq"
# Linguistic software and Finnish dictionary
brew "libvoikko"
# Package manager for the Lua programming language
@@ -140,6 +147,14 @@ brew "openapi-generator"
brew "pandoc"
# Highly capable, feature-rich programming language
brew "perl"
# General-purpose scripting language
brew "php@8.1"
# Python version management
brew "pyenv"
# Migrate pip packages from one Python version to another
brew "pyenv-pip-migrate"
# Pyenv plugin to manage virtualenv
brew "pyenv-virtualenv"
# Interpreted, interactive, object-oriented programming language
brew "python@3.10"
# Interpreted, interactive, object-oriented programming language
@@ -168,6 +183,8 @@ brew "terragrunt"
brew "testssl"
# Terraform version manager inspired by rbenv
brew "tfenv"
# Static analysis security scanner for your terraform code
brew "tfsec"
# Programmatically correct mistyped console commands
brew "thefuck"
# Simplified and community-driven man pages
@@ -178,6 +195,8 @@ brew "tmux"
brew "tree"
# Modern watch command
brew "viddy"
# Tool for creating isolated virtual python environments
brew "virtualenv"
# Command-line interface to the WakaTime api
brew "wakatime-cli"
# Executes a program periodically, showing output fullscreen
@@ -196,6 +215,8 @@ brew "anchore/grype/grype"
brew "ddosify/tap/ddosify"
# lets you quickly switch between multiple git user profiles
brew "gesquive/tap/git-user"
# A simple terminal UI for git commands, written in Go
brew "jesseduffield/lazygit/lazygit"
# High-performance, schema-free, document-oriented database
brew "mongodb/brew/mongodb-community"
# Xdebug PHP extension

View File

@@ -28,7 +28,7 @@ if [ command -v brew &> /dev/null ]; then
BREW_BIN=$(brew --prefix)/bin
BREW_SBIN=$(brew --prefix)/sbin
BREW_PYTHON=$(brew --prefix python@3.8)/bin
BREW_PYTHON=$(brew --prefix python)/bin
GNUBIN_DIR=$(brew --prefix coreutils)/libexec/gnubin
BREW_RUBY=$(brew --prefix ruby)/bin
BREW_GEMS=$(gem environment gemdir)/bin
@@ -47,10 +47,8 @@ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || pr
# If we have go packages, include them to the PATH
if command -v go &> /dev/null; then
export GOPATH="$XDG_DATA_HOME/go";
export GOBIN="$XDG_BIN_HOME"
mkdir -p "$GOPATH"
if [ -d "$GOPATH/bin" ]; then
export PATH="$GOPATH/bin:$PATH"
fi
fi
if command -v nvim &> /dev/null; then
@@ -74,6 +72,15 @@ if command -v gem &>/dev/null; then
fi
# pyenv, python environments
export PYENV_ROOT="$XDG_STATE_HOME/pyenv"
mkdir -p "$PYENV_ROOT"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv &>/dev/null; then
eval "$(pyenv init -)"
fi
# wakatime, https://github.com/wakatime/wakatime-cli
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"

View File

@@ -1,4 +1,4 @@
# shellcheck shell=bash
#!/usr/bin/env bash
# macOS specific
# Get installed php versions from brew and setup aliases

View File

@@ -26,6 +26,5 @@ export GREP_OPTIONS="--color=auto"
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
hash shopt 2>/dev/null && shopt -s checkwinsize

View File

@@ -1,4 +1,4 @@
# shellcheck shell=bash
#!/usr/bin/env bash
#
# shell functions
#

View File

@@ -2,6 +2,10 @@
name = Ismo Vuorinen
email = ismo@ivuorinen.net
[credential]
helper = store --file ~/.cache/git/git-credentials
helper = cache --timeout 30000
[core]
excludesfile = ~/.config/git/gitignore

View File

@@ -0,0 +1,9 @@
blade-formatter
corepack
editorconfig-checker
github-release-notes
js-debug
neovim
prettier
standardjs
stylelint-lsp

View File

@@ -177,4 +177,4 @@ wtf:
left: 1
height: 1
width: 3
refreshInterval: 3600
refreshInterval: 3600

View File

@@ -23,4 +23,3 @@ git submodule update --init --recursive
# --plugin-dir=dotbot-plugins/dotbot-if \
# --plugin-dir=dotbot-plugins/dotbot-ifplatform \
# -p dotbot-plugins/dotbot-if/if.py \

View File

@@ -1,30 +1,27 @@
---
- defaults:
brewfile:
stderr: true
stdout: true
create:
mode: 755
mode: 0755
link:
create: true
relink: true
exclude: ["*.md"]
- clean:
~/:
~/.config:
recursive: true
~/.local:
recursive: true
- create:
~/.config:
~/.local:
~/.local/share:
~/.local/state:
~/.ssh:
mode: 700
mode: 0700
~/Code:
- link:
~/.config/:
glob: true
@@ -35,33 +32,37 @@
~/.ssh/:
force: true
glob: true
mode: 600
mode: 0600
path: ssh/*
~/:
force: true
glob: true
path: base/*
prefix: "."
- shell:
- [git submodule update --init --recursive --force]
- [bash scripts/install-npm-packages.sh]
- [chsh -s $(which zsh), Making zsh the default shell]
- ifmacos:
- shell:
- [bash scripts/set-macos-defaults.sh]
- brewfile:
- Brewfile
# hosts: air
# Go packages what should be included in every system
- go:
- github.com/skx/sysbox@latest
- github.com/dotzero/git-profile
- github.com/google/yamlfmt/cmd/yamlfmt@latest
# hosts!
## hosts: air
- if:
- cond: "[[ $(hostname) = air ]]"
met:
- go:
- github.com/skx/sysbox@latest
- github.com/dotzero/git-profile
# hosts: v
- link:
~/.config/:
glob: true
force: true
path: hosts/air/config/**
## hosts: v
- if:
- cond: "[[ $(hostname) = v ]]"
met:
@@ -70,19 +71,16 @@
glob: true
force: true
path: hosts/v/config/**
- go:
- github.com/skx/sysbox@latest
- github.com/dotzero/git-profile
# hosts tunkki
## hosts: tunkki
- if:
- cond: "[[ $(hostname) = tunkki ]]"
met:
- go:
- github.com/skx/sysbox@latest
- github.com/dotzero/git-profile
# hosts: lakka
- link:
~/.config/:
glob: true
force: true
path: hosts/tunkki/config/**
## hosts: lakka
- if:
- cond: "[[ $(hostname) = lakka ]]"
met:
@@ -94,7 +92,6 @@
~/.zshrc:
force: true
path: hosts/lakka/zshrc
# GitHub CLI Extensions
- ghe:
# GitHub CLI extension for generating a report on repository dependencies.
@@ -114,4 +111,5 @@
# being an extension to view the overall health of
# an organization's use of actions
- rsese/gh-actions-status
#

View File

@@ -49,10 +49,11 @@ function section_install
bash "$DOTFILES/scripts/settler.sh" && msg_done "🎉 Settler has been run!"
;;
*)
menu_section "$USAGE_PREFIX" "all | antigen | starship | npm | macos | settler"
menu_section "$USAGE_PREFIX" "all | antigen | starship | nvm | npm | macos | settler"
menu_item "all" "Installs antigen, macos, brew and ext_gh"
menu_item "antigen" "Updates the antigen.zsh file"
menu_item "starship" "Install starship.rs"
menu_item "nvm" "Install Node Version Manager (nvm)"
menu_item "npm" "Install NPM Packages"
menu_item "macos" "Setup nice macOS defaults"
menu_item "settler" "Runs the WIP settler.sh"
@@ -117,21 +118,34 @@ function section_dotfiles
ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim
ln -s ~/.dotfiles/config/nvim ~/.config/nvim
msg_ok "Linked nvim and astronvim"
hash npm 2>/dev/null && $0 install npm
hash npm 2> /dev/null && $0 install npm
msg_ok "Installed packages"
msg_done "...and we are done!"
;;
yamlfmt)
# format yaml files
yamlfmt -conf "$DOTFILES/.yamlfmt"
;;
shfmt)
# Format shell scripts according to following rules.
find "$DOTFILES" \
\( -name '*.sh' -or -name '*.zsh' -or -name 'x-*' \) \
-exec shfmt -fn -l -w -i 2 -ci -sr -bn {} \;
-type f -perm +111 \
-not -path '*/.git/*' \
-not -path '*dotbot*' \
-not -name '*.pl' \
-not -name '*.py' \
-exec shfmt \
--language-dialect bash \
--func-next-line --list --write \
--indent 2 --case-indent --space-redirects \
--binary-next-line {} \;
msg_done "🎉 dotfiles have been formatted!"
;;
*)
menu_section "$USAGE_PREFIX" "reset_all | reset_nvim | shfmt"
menu_section "$USAGE_PREFIX" "reset_all | reset_nvim | yamlfmt | shfmt"
menu_item "reset_all" "Reset everything, runs all configured reset actions"
menu_item "reset_nvim" "Resets nvim. Deletes caches, removes nvim folders and relinks nvim folders"
menu_item "yamlfmt" "Run yamlfmt to all dotfiles, which are in our control"
menu_item "shfmt" "Run shfmt to all dotfiles"
;;
esac
@@ -144,11 +158,11 @@ function section_check
X_ARCH=$(uname)
case "$1" in
a|arch)
a | arch)
[[ "$2" = "" ]] && echo "$X_ARCH" && exit 0
[[ $X_ARCH = "$2" ]] && exit 0 || exit 1
;;
h|host|hostname)
h | host | hostname)
[[ "$2" = "" ]] && echo "$X_HOSTNAME" && exit 0
[[ $X_HOSTNAME = "$2" ]] && exit 0 || exit 1
;;
@@ -209,4 +223,3 @@ case "$1" in
tests) section_tests "$2" ;;
*) usage && exit 0 ;;
esac

View File

@@ -80,4 +80,3 @@ trap 'case $? in
esac' EXIT
gitdirtyrepos "$GIT_DIRTY_DIR"

View File

@@ -2,12 +2,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -17,7 +17,8 @@ if [[ -o interactive ]]; then
ITERM_SHELL_INTEGRATION_INSTALLED=Yes
ITERM2_SHOULD_DECORATE_PROMPT="1"
# Indicates start of command output. Runs just before command executes.
iterm2_before_cmd_executes() {
iterm2_before_cmd_executes()
{
if [ "$TERM_PROGRAM" = "iTerm.app" ]; then
printf "\033]133;C;\r\007"
else
@@ -25,7 +26,8 @@ if [[ -o interactive ]]; then
fi
}
iterm2_set_user_var() {
iterm2_set_user_var()
{
printf "\033]1337;SetUserVar=%s=%s\007" "$1" $(printf "%s" "$2" | base64 | tr -d '\n')
}
@@ -36,15 +38,17 @@ if [[ -o interactive ]]; then
# \(user.currentDirectory).
whence -v iterm2_print_user_vars > /dev/null 2>&1
if [ $? -ne 0 ]; then
iterm2_print_user_vars() {
true
iterm2_print_user_vars()
{
true
}
fi
iterm2_print_state_data() {
iterm2_print_state_data()
{
local _iterm2_hostname="${iterm2_hostname-}"
if [ -z "${iterm2_hostname:-}" ]; then
_iterm2_hostname=$(hostname -f 2>/dev/null)
_iterm2_hostname=$(hostname -f 2> /dev/null)
fi
printf "\033]1337;RemoteHost=%s@%s\007" "$USER" "${_iterm2_hostname-}"
printf "\033]1337;CurrentDir=%s\007" "$PWD"
@@ -52,18 +56,21 @@ if [[ -o interactive ]]; then
}
# Report return code of command; runs after command finishes but before prompt
iterm2_after_cmd_executes() {
iterm2_after_cmd_executes()
{
printf "\033]133;D;%s\007" "$STATUS"
iterm2_print_state_data
}
# Mark start of prompt
iterm2_prompt_mark() {
iterm2_prompt_mark()
{
printf "\033]133;A\007"
}
# Mark end of prompt
iterm2_prompt_end() {
iterm2_prompt_end()
{
printf "\033]133;B\007"
}
@@ -105,7 +112,8 @@ if [[ -o interactive ]]; then
# * PS1 does not have our escape sequences during command execution
# * After the command executes but before a new one begins, PS1 has escape sequences and
# ITERM2_PRECMD_PS1 has PS1's original value.
iterm2_decorate_prompt() {
iterm2_decorate_prompt()
{
# This should be a raw PS1 without iTerm2's stuff. It could be changed during command
# execution.
ITERM2_PRECMD_PS1="$PS1"
@@ -126,7 +134,8 @@ if [[ -o interactive ]]; then
ITERM2_DECORATED_PS1="$PS1"
}
iterm2_precmd() {
iterm2_precmd()
{
local STATUS="$?"
if [ -z "${ITERM2_SHOULD_DECORATE_PROMPT-}" ]; then
# You pressed ^C while entering a command (iterm2_preexec did not run)
@@ -145,7 +154,8 @@ if [[ -o interactive ]]; then
}
# This is not run if you press ^C while entering a command.
iterm2_preexec() {
iterm2_preexec()
{
# Set PS1 back to its raw value prior to executing the command.
PS1="$ITERM2_PRECMD_PS1"
ITERM2_SHOULD_DECORATE_PROMPT="1"
@@ -158,10 +168,10 @@ if [[ -o interactive ]]; then
# to a VPN.
if [ -z "${iterm2_hostname-}" ]; then
if [ "$(uname)" != "Darwin" ]; then
iterm2_hostname=`hostname -f 2>/dev/null`
iterm2_hostname=$(hostname -f 2> /dev/null)
# Some flavors of BSD (i.e. NetBSD and OpenBSD) don't have the -f option.
if [ $? -ne 0 ]; then
iterm2_hostname=`hostname`
iterm2_hostname=$(hostname)
fi
fi
fi

View File

@@ -10,14 +10,14 @@ if [ -z "${DIRECTORY}" ]; then
fi
if [ -z "${FILENAME}" ]; then
FILENAME=$DIRECTORY
FILENAME=$DIRECTORY
fi
FILENAME=${FILENAME} | \
tr '/' _ | \
iconv -t ascii//TRANSLIT | \
sed -r s/[^a-zA-Z0-9]+/_/g | \
sed -r s/^_+\|-+$//g
FILENAME=${FILENAME} \
| tr '/' _ \
| iconv -t ascii//TRANSLIT \
| sed -r s/[^a-zA-Z0-9]+/_/g \
| sed -r s/^_+\|-+$//g
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
FILENAME_TIMESTAMP="${FILENAME}_${TIMESTAMP}"

View File

@@ -41,4 +41,3 @@ mysqldump \
| mysql "${DATABASE}" \
| sed '/Tables_in/d'
)" > "${FILENAME_TIMESTAMP}"

View File

@@ -17,4 +17,3 @@ if [[ "$missing_attributes" ]]; then
else
echo "All files have a corresponding rule in .gitattributes"
fi

View File

@@ -14,4 +14,3 @@ for dir in $($cmd); do
eval "$@" # allow multiple commands like "foo && bar"
)
done

View File

@@ -19,4 +19,3 @@ lsof -i 4 -P -n +c 0 \
| uniq
echo ""

View File

@@ -104,4 +104,3 @@ for name in "$@"; do
echo " Days: ${diff}"
fi
done

View File

@@ -10,4 +10,3 @@
while [ $? -eq 0 ]; do
"$@"
done

View File

@@ -22,4 +22,3 @@
while [ $? -ne 0 ]; do
"$@"
done

View File

@@ -50,4 +50,3 @@ elif [ "$(get_sha256sum "$filename")" = "$file_hash" ]; then
else
error "$filename doesn't match provided sha256sum"
fi

View File

@@ -30,4 +30,3 @@ done
shift
"$@"

View File

@@ -43,4 +43,3 @@ if [ "$1" != "ssh" ]; then
fi
"$@"

View File

@@ -36,4 +36,3 @@ else
echo ""
done
fi

View File

@@ -6,7 +6,7 @@
# - https://github.com/freekmurze/dotfiles/blob/main/macos/set-defaults.sh
#
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0;
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0
# Ask for the administrator password upfront
sudo -v
@@ -299,4 +299,3 @@ for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
killall "${app}" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."

View File

@@ -111,4 +111,3 @@ function fn_exists()
declare -f -F "$1" > /dev/null
return $?
}