mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-27 20:45:31 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 740ad17207 | |||
| c9d0284c91 | |||
| ac8b7beb9b | |||
| 2fa6c69e4a | |||
| c1287c4ea8 | |||
| 7b63afd4f5 | |||
| e5d6cb37fd | |||
| 4492c386b6 | |||
| 5f5f79d270 | |||
| dcd042262f | |||
| 268fd35bdb | |||
| 38a6f6f8e4 | |||
| d504fc5f2b |
@@ -7,25 +7,3 @@ indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.lua]
|
||||
insert_final_newline = true
|
||||
|
||||
[*.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
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,6 @@
|
||||
Brewfile.lock.json
|
||||
*.log
|
||||
*-secret
|
||||
*cache
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
|
||||
5
.gitmodules
vendored
5
.gitmodules
vendored
@@ -8,11 +8,6 @@
|
||||
url = https://github.com/wren/dotbot-brew.git
|
||||
ignore = dirty
|
||||
|
||||
[submodule "dotbot-gh-extension"]
|
||||
path = dotbot-gh-extension
|
||||
url = https://github.com/fundor333/dotbot-gh-extension.git
|
||||
ignore = dirty
|
||||
|
||||
[submodule "dotbot-include"]
|
||||
path = dotbot-include
|
||||
url = https://gitlab.com/gnfzdz/dotbot-include.git
|
||||
|
||||
1
.yamlfmt
1
.yamlfmt
@@ -22,4 +22,3 @@ exclude:
|
||||
- ./dotbot-*/**
|
||||
- ./config/astronvim/**
|
||||
- ./config/nvim/**
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
git submodule add --name dotbot-brew -f https://github.com/wren/dotbot-brew.git dotbot-brew
|
||||
git submodule add --name dotbot-gh-extension -f https://github.com/fundor333/dotbot-gh-extension.git dotbot-gh-extension
|
||||
git submodule add --name dotbot-include -f https://gitlab.com/gnfzdz/dotbot-include.git dotbot-include
|
||||
|
||||
10
base/zshrc
10
base/zshrc
@@ -6,6 +6,8 @@ colors
|
||||
|
||||
# Defaults
|
||||
export DOTFILES="$HOME/.dotfiles"
|
||||
# shellcheck source=shared.sh
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
|
||||
# Run x-load-configs in your terminal to reload the files.
|
||||
function x-load-configs()
|
||||
@@ -28,14 +30,14 @@ ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
|
||||
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
|
||||
|
||||
# antigen is present
|
||||
if command -v antigen &> /dev/null; then
|
||||
have antigen && {
|
||||
antigen use oh-my-zsh
|
||||
|
||||
# config/functions
|
||||
x-default-antigen-bundles
|
||||
|
||||
antigen apply
|
||||
fi
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
}
|
||||
|
||||
# starship is present
|
||||
have starship && eval "$(starship init zsh)"
|
||||
|
||||
26
config/alias
26
config/alias
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck source="../scripts/shared.sh"
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
|
||||
# Get installed php versions from brew and setup aliases
|
||||
function x-set-php-aliases
|
||||
{
|
||||
if command -v brew &> /dev/null; then
|
||||
have brew && {
|
||||
local php_versions=()
|
||||
while IFS="" read -r line; do php_versions+=("$line"); done < <(brew list | grep '^php')
|
||||
|
||||
@@ -31,7 +33,7 @@ function x-set-php-aliases
|
||||
# shellcheck disable=SC2139,SC2140
|
||||
alias "${php_alias}c"="$php_exec $php_error_reporting $(which composer)"
|
||||
done
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
if [[ $(uname) == 'Darwin' ]]; then
|
||||
@@ -52,10 +54,18 @@ if [[ $(uname) == 'Darwin' ]]; then
|
||||
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl"
|
||||
fi
|
||||
|
||||
alias watchx='watch -dpbc' # watch with: differences, precise, beep and color
|
||||
# watch with: differences, precise, beep and color
|
||||
alias watchx='watch -dpbc'
|
||||
# delete .DS_Store files
|
||||
alias zapds='find . -name ".DS_Store" -print -delete'
|
||||
alias t='tail -f' # tail with follow flag on
|
||||
alias dn='du -chd1' # directory usage, return only the total
|
||||
# tail with follow flag on
|
||||
alias t='tail -f'
|
||||
# directory usage, return only the total
|
||||
alias dn='du -chd1'
|
||||
# Mirror site with wget
|
||||
alias mirror_site='wget -m -k -K -E -e robots=off'
|
||||
# Mirror stdout to stderr, useful for seeing data going through a pipe
|
||||
alias peek='tee >(cat 1>&2)'
|
||||
|
||||
alias code_scanner='docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
@@ -66,10 +76,8 @@ alias code_scanner='docker run
|
||||
|
||||
alias zedit='$EDITOR ~/.dotfiles'
|
||||
|
||||
if hash irssi 2> /dev/null; then
|
||||
# shellcheck disable=2139
|
||||
alias irssi="irssi --config='$IRSSI_CONFIG_FILE' --home='$IRSSI_CONFIG_HOME'"
|
||||
fi
|
||||
have irssi \
|
||||
&& alias irssi="irssi --config='$IRSSI_CONFIG_FILE' --home='$IRSSI_CONFIG_HOME'"
|
||||
|
||||
if [[ -f "$HOME/.aliases.local" ]]; then
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
Submodule config/astronvim/lua/user updated: 6409f428be...95cad51402
1
config/cheat/cheatsheets/community
Submodule
1
config/cheat/cheatsheets/community
Submodule
Submodule config/cheat/cheatsheets/community added at 36bdb99dcf
84
config/cheat/conf.yml
Normal file
84
config/cheat/conf.yml
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
||||
editor: EDITOR_PATH
|
||||
|
||||
# Should 'cheat' always colorize output?
|
||||
colorize: true
|
||||
|
||||
# Which 'chroma' colorscheme should be applied to the output?
|
||||
# Options are available here:
|
||||
# https://github.com/alecthomas/chroma/tree/master/styles
|
||||
style: monokai
|
||||
|
||||
# Which 'chroma' "formatter" should be applied?
|
||||
# One of: "terminal", "terminal256", "terminal16m"
|
||||
formatter: terminal16m
|
||||
|
||||
# Through which pager should output be piped?
|
||||
# 'less -FRX' is recommended on Unix systems
|
||||
# 'more' is recommended on Windows
|
||||
pager: PAGER_PATH
|
||||
|
||||
# Cheatpaths are paths at which cheatsheets are available on your local
|
||||
# filesystem.
|
||||
#
|
||||
# It is useful to sort cheatsheets into different cheatpaths for organizational
|
||||
# purposes. For example, you might want one cheatpath for community
|
||||
# cheatsheets, one for personal cheatsheets, one for cheatsheets pertaining to
|
||||
# your day job, one for code snippets, etc.
|
||||
#
|
||||
# Cheatpaths are scoped, such that more "local" cheatpaths take priority over
|
||||
# more "global" cheatpaths. (The most global cheatpath is listed first in this
|
||||
# file; the most local is listed last.) For example, if there is a 'tar'
|
||||
# cheatsheet on both global and local paths, you'll be presented with the local
|
||||
# one by default. ('cheat -p' can be used to view cheatsheets from alternative
|
||||
# cheatpaths.)
|
||||
#
|
||||
# Cheatpaths can also be tagged as "read only". This instructs cheat not to
|
||||
# automatically create cheatsheets on a read-only cheatpath. Instead, when you
|
||||
# would like to edit a read-only cheatsheet using 'cheat -e', cheat will
|
||||
# perform a copy-on-write of that cheatsheet from a read-only cheatpath to a
|
||||
# writeable cheatpath.
|
||||
#
|
||||
# This is very useful when you would like to maintain, for example, a
|
||||
# "pristine" repository of community cheatsheets on one cheatpath, and an
|
||||
# editable personal reponsity of cheatsheets on another cheatpath.
|
||||
#
|
||||
# Cheatpaths can be also configured to automatically apply tags to cheatsheets
|
||||
# on certain paths, which can be useful for querying purposes.
|
||||
# Example: 'cheat -t work jenkins'.
|
||||
#
|
||||
# Community cheatsheets must be installed separately, though you may have
|
||||
# downloaded them automatically when installing 'cheat'. If not, you may
|
||||
# download them here:
|
||||
#
|
||||
# https://github.com/cheat/cheatsheets
|
||||
cheatpaths:
|
||||
# Cheatpath properties mean the following:
|
||||
# 'name': the name of the cheatpath
|
||||
# (view with 'cheat -d', filter with 'cheat -p')
|
||||
# 'path': the filesystem path of the cheatsheet directory
|
||||
# (view with 'cheat -d')
|
||||
# 'tags': tags that should be automatically applied to sheets on this path
|
||||
# 'readonly': shall user-created ('cheat -e') cheatsheets be saved here?
|
||||
- name: community
|
||||
path: ~/.config/cheat/cheatsheets/community
|
||||
tags: [ community ]
|
||||
readonly: true
|
||||
|
||||
# If you have personalized cheatsheets, list them last. They will take
|
||||
# precedence over the more global cheatsheets.
|
||||
- name: personal
|
||||
path: ~/.config/cheat/cheatsheets/personal
|
||||
tags: [ personal ]
|
||||
readonly: false
|
||||
|
||||
# While it requires no configuration here, it's also worth noting that
|
||||
# cheat will automatically append directories named '.cheat' within the
|
||||
# current working directory to the 'cheatpath'. This can be very useful if
|
||||
# you'd like to closely associate cheatsheets with, for example, a directory
|
||||
# containing source code.
|
||||
#
|
||||
# Such "directory-scoped" cheatsheets will be treated as the most "local"
|
||||
# cheatsheets, and will override less "local" cheatsheets. Similarly,
|
||||
# directory-scoped cheatsheets will always be editable ('readonly: false').
|
||||
@@ -3,7 +3,8 @@
|
||||
# vim: filetype=zsh
|
||||
|
||||
export DOTFILES="$HOME/.dotfiles"
|
||||
export PATH="$DOTFILES/local/bin:$PATH"
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
path_append "$DOTFILES/local/bin"
|
||||
|
||||
# Explicitly set XDG folders
|
||||
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
@@ -23,22 +24,20 @@ export HOMEBREW_SBIN="$HOMEBREW/sbin"
|
||||
export HOMEBREW_PKG="$HOMEBREW/opt"
|
||||
export HOMEBREW_NO_ENV_HINTS=1
|
||||
|
||||
export PATH="$XDG_BIN_HOME:$HOMEBREW_BIN:$HOMEBREW_SBIN:/usr/local/sbin:$PATH"
|
||||
path_append "/usr/local/bin"
|
||||
path_append "$HOMEBREW_SBIN"
|
||||
path_append "$HOMEBREW_BIN"
|
||||
path_append "$XDG_BIN_HOME"
|
||||
|
||||
# brew, https://brew.sh
|
||||
if command -v brew &> /dev/null; then
|
||||
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
|
||||
|
||||
export PATH="$BREW_PYTHON:$GNUBIN_DIR:$BREW_GEMS:$BREW_RUBY:$PATH"
|
||||
fi
|
||||
have brew && {
|
||||
path_append "$(brew --prefix python)/bin"
|
||||
path_append "$(brew --prefix coreutils)/libexec/gnubin"
|
||||
path_append "$(brew --prefix ruby)/bin"
|
||||
path_append "$(gem environment gemdir)/bin"
|
||||
}
|
||||
|
||||
source "$DOTFILES/config/exports-shell"
|
||||
source "$DOTFILES/config/exports-apps"
|
||||
|
||||
if command -v nvim &> /dev/null; then
|
||||
export EDITOR="nvim"
|
||||
fi
|
||||
|
||||
have nvim && export EDITOR="nvim"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck enable=external-sources
|
||||
# vim: filetype=zsh
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
|
||||
# Antigen configuration
|
||||
# https://github.com/zsh-users/antigen/wiki/Configuration
|
||||
@@ -11,61 +12,62 @@ export ANTIGEN_PLUGIN_RECEIPT_F=".local/share/antigen/antigen_plugin_lastupdate"
|
||||
|
||||
# Ansible configuration
|
||||
# https://docs.ansible.com/ansible/latest/reference_appendices/config.html
|
||||
if hash ansible 2> /dev/null; then
|
||||
have ansible && {
|
||||
export ANSIBLE_HOME="$XDG_CONFIG_HOME/ansible"
|
||||
export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible.cfg"
|
||||
export ANSIBLE_GALAXY_CACHE_DIR="$XDG_CACHE_HOME/ansible/galaxy_cache"
|
||||
x-dc "$ANSIBLE_HOME"
|
||||
x-dc "$ANSIBLE_GALAXY_CACHE_DIR"
|
||||
fi
|
||||
}
|
||||
|
||||
# composer, https://getcomposer.org/
|
||||
if command -v composer &> /dev/null; then
|
||||
have composer && {
|
||||
export COMPOSER_HOME="$XDG_STATE_HOME/composer"
|
||||
export COMPOSER_BIN="$COMPOSER_HOME/vendor/bin"
|
||||
export PATH="$COMPOSER_BIN:$PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
# docker, https://docs.docker.com/engine/reference/commandline/cli/
|
||||
if command -v docker &> /dev/null; then
|
||||
have docker && {
|
||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
|
||||
x-dc "$DOCKER_CONFIG"
|
||||
fi
|
||||
}
|
||||
|
||||
# ffmpeg
|
||||
if hash ffmpeg 2> /dev/null; then
|
||||
have ffmpeg && {
|
||||
export FFMPEG_DATADIR="$XDG_CONFIG_HOME/ffmpeg"
|
||||
x-dc "$FFMPEG_DATADIR"
|
||||
fi
|
||||
}
|
||||
|
||||
# gcloud
|
||||
if hash gcloud 2>/dev/null; then
|
||||
have gcloud && {
|
||||
GCLOUD_LOC=$(gcloud info --format="value(installation.sdk_root)" --quiet)
|
||||
[[ -f "$GCLOUD_LOC/path.zsh.inc" ]] && builtin source "$GCLOUD_LOC/path.zsh.inc"
|
||||
[[ -f "$GCLOUD_LOC/completion.zsh.inc" ]] && builtin source "$GCLOUD_LOC/completion.zsh.inc"
|
||||
fi
|
||||
}
|
||||
|
||||
# gem, rubygems
|
||||
if command -v gem &> /dev/null; then
|
||||
have gem && {
|
||||
export GEM_HOME="$XDG_STATE_HOME/gem"
|
||||
export GEM_PATH="$XDG_STATE_HOME/gem"
|
||||
export PATH="$GEM_HOME/bin:$PATH"
|
||||
fi
|
||||
path_append "$GEM_PATH/bin"
|
||||
}
|
||||
|
||||
# If we have go packages, include them to the PATH
|
||||
if command -v go &> /dev/null; then
|
||||
have go && {
|
||||
export GOPATH="$XDG_DATA_HOME/go"
|
||||
export GOBIN="$XDG_BIN_HOME"
|
||||
x-dc "$GOPATH"
|
||||
fi
|
||||
}
|
||||
|
||||
# irssi
|
||||
if hash irssi 2> /dev/null; then
|
||||
have irssi && {
|
||||
# These variables are used in ./alias with --config and --home
|
||||
export IRSSI_CONFIG_HOME="$XDG_CONFIG_HOME/irssi"
|
||||
export IRSSI_CONFIG_FILE="$IRSSI_CONFIG_HOME/config"
|
||||
x-dc "$IRSSI_CONFIG_HOME"
|
||||
fi
|
||||
}
|
||||
|
||||
# nvm, the node version manager
|
||||
export NVM_LAZY_LOAD=true
|
||||
@@ -76,21 +78,21 @@ export NVM_DIR="$XDG_CONFIG_HOME/nvm"
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
# op (1Password cli) is present
|
||||
if hash op 2> /dev/null; then
|
||||
have op && {
|
||||
export OP_CACHE="$XDG_STATE_HOME/1password"
|
||||
x-dc "$OP_CACHE"
|
||||
eval "$(op completion zsh)"
|
||||
compdef _op op
|
||||
fi
|
||||
}
|
||||
|
||||
# pyenv, python environments
|
||||
if command -v pyenv &> /dev/null; then
|
||||
have pyenv && {
|
||||
export PYENV_ROOT="$XDG_STATE_HOME/pyenv"
|
||||
x-dc "$PYENV_ROOT"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
path_append "$PYENV_ROOT/bin"
|
||||
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
}
|
||||
|
||||
# wakatime, https://github.com/wakatime/wakatime-cli
|
||||
export WAKATIME_HOME="$XDG_STATE_HOME/wakatime"
|
||||
@@ -103,3 +105,4 @@ export _Z_DATA="$XDG_STATE_HOME/z"
|
||||
# Misc
|
||||
export ANDROID_HOME="$XDG_DATA_HOME/android"
|
||||
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
|
||||
export SCREENRC="$XDG_CONFIG_HOME/misc/screenrc"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
# vim: filetype=zsh
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
|
||||
export LC_ALL=fi_FI.utf8
|
||||
|
||||
@@ -39,10 +40,7 @@ hash shopt 2> /dev/null && shopt -s checkwinsize
|
||||
&& source "$XDG_BIN_HOME/iterm2_shell_integration.zsh"
|
||||
|
||||
# Set dircolors based on the file, if it exists
|
||||
if command -v dircolors &> /dev/null; then
|
||||
# shellcheck disable=SC2046
|
||||
eval $(dircolors "$XDG_CONFIG_HOME/dircolors")
|
||||
fi
|
||||
have dircolors && eval $(dircolors "$XDG_CONFIG_HOME/dircolors")
|
||||
|
||||
# If we are using zsh, color our dir lists and such
|
||||
if [ "$SHELL" = "$(which zsh)" ]; then
|
||||
@@ -52,4 +50,3 @@ if [ "$SHELL" = "$(which zsh)" ]; then
|
||||
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/zcompcache"
|
||||
zstyle ':completion:*' list-colors "$LS_COLORS"
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#
|
||||
# shell functions
|
||||
#
|
||||
# shellcheck source="../scripts/shared.sh"
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
|
||||
# Weather in Tampere, or other city
|
||||
function weather
|
||||
@@ -81,14 +83,13 @@ function x-default-antigen-bundles
|
||||
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||
|
||||
# these should be available if there's need
|
||||
hash git 2> /dev/null && antigen bundle git
|
||||
hash brew 2> /dev/null && antigen bundle brew
|
||||
hash docker 2> /dev/null && antigen bundle docker
|
||||
hash docker-compose 2> /dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
||||
hash jq 2> /dev/null && antigen bundle reegnz/jq-zsh-plugin
|
||||
hash nvm 2> /dev/null && antigen bundle nvm
|
||||
hash php 2> /dev/null && antigen bundle php
|
||||
hash python 2> /dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
||||
hash rvm 2> /dev/null && antigen bundle unixorn/rvm-plugin
|
||||
have git && antigen bundle git
|
||||
have brew && antigen bundle brew
|
||||
have docker && antigen bundle docker
|
||||
have docker-compose && antigen bundle sroze/docker-compose-zsh-plugin
|
||||
have jq && antigen bundle reegnz/jq-zsh-plugin
|
||||
have nvm && antigen bundle nvm
|
||||
have php && antigen bundle php
|
||||
have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
||||
have rvm && antigen bundle unixorn/rvm-plugin
|
||||
}
|
||||
|
||||
|
||||
16
config/misc/screenrc
Normal file
16
config/misc/screenrc
Normal file
@@ -0,0 +1,16 @@
|
||||
# Disable the startup message
|
||||
startup_message off
|
||||
|
||||
# Set a large scrollback buffer
|
||||
defscrollback 32000
|
||||
|
||||
# Always start `screen` with UTF-8 enabled (`screen -U`)
|
||||
defutf8 on
|
||||
|
||||
# Scroll with mouse wheel (http://stackoverflow.com/a/1125947)
|
||||
termcapinfo xterm* ti@:te@
|
||||
|
||||
# Some settings for screen + vim
|
||||
term xterm-256color
|
||||
maptimeout 10
|
||||
|
||||
Submodule config/nvim updated: 291c43b0bd...cf624ae587
32
config/yamllint/config
Normal file
32
config/yamllint/config
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
extends: default
|
||||
|
||||
ignore-from-file: [.gitignore, .yamlignore]
|
||||
|
||||
rules:
|
||||
braces:
|
||||
level: warning
|
||||
max-spaces-inside: 1
|
||||
brackets:
|
||||
level: warning
|
||||
max-spaces-inside: 1
|
||||
colons:
|
||||
level: warning
|
||||
commas:
|
||||
level: warning
|
||||
comments: disable
|
||||
comments-indentation: disable
|
||||
document-start: disable
|
||||
empty-lines:
|
||||
level: warning
|
||||
hyphens:
|
||||
level: warning
|
||||
indentation:
|
||||
level: warning
|
||||
indent-sequences: consistent
|
||||
line-length:
|
||||
level: warning
|
||||
allow-non-breakable-inline-mappings: true
|
||||
max: 120
|
||||
truthy: disable
|
||||
|
||||
Submodule dotbot-gh-extension deleted from 037994ef28
Submodule dotbot-include updated: 6943c52125...88e6471cd6
@@ -36,24 +36,3 @@
|
||||
- shell:
|
||||
- git submodule update --init --recursive --force
|
||||
- bash local/bin/dfm install all
|
||||
# GitHub CLI Extensions
|
||||
- ghe:
|
||||
# GitHub CLI extension for generating a report on repository dependencies.
|
||||
- andyfeller/gh-dependency-report
|
||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||
- andyfeller/gh-montage
|
||||
# An opinionated GitHub Cli extension for creating
|
||||
# changelogs that adhere to the keep a changelog specification.
|
||||
- chelnak/gh-changelog
|
||||
# Safely deletes local branches with no upstream and no un-pushed commits
|
||||
- davidraviv/gh-clean-branches
|
||||
# A beautiful CLI dashboard for GitHub 🚀
|
||||
- dlvhdr/gh-dash
|
||||
# A github-cli extension script to clone all repositories
|
||||
# in an organization, optionally filtering by topic.
|
||||
- matt-bartel/gh-clone-org
|
||||
# being an extension to view the overall health of
|
||||
# an organization's use of actions
|
||||
- rsese/gh-actions-status
|
||||
|
||||
#
|
||||
|
||||
168
local/bin/dfm
168
local/bin/dfm
@@ -9,18 +9,37 @@
|
||||
# Helper variables, override with ENVs like `VERBOSE=1 dfm help`
|
||||
: "${VERBOSE:=0}"
|
||||
: "${DOTFILES:=$HOME/.dotfiles}"
|
||||
: "${SHARED_SCRIPT:=$DOTFILES/scripts/shared.sh}"
|
||||
: "${INSTALL_SCRIPT:=$DOTFILES/scripts/install-dotfiles.sh}"
|
||||
: "${BREWFILE:=$DOTFILES/Brewfile}"
|
||||
: "${HOSTFILES:=$DOTFILES/hosts}"
|
||||
|
||||
SCRIPT=$(basename "$0")
|
||||
|
||||
VERSION_NVM="v0.39.3"
|
||||
|
||||
# shellcheck source=./../../scripts/shared.sh
|
||||
source "$DOTFILES/scripts/shared.sh"
|
||||
source "$SHARED_SCRIPT"
|
||||
|
||||
function section_install
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT install"
|
||||
USAGE_PREFIX="$SCRIPT install <command>"
|
||||
|
||||
MENU=(
|
||||
"all:Installs everything in the correct order"
|
||||
"antigen:Updates the antigen.zsh file"
|
||||
"composer:Install composer"
|
||||
"dotenv:Install dotenv-linter"
|
||||
"gh:Install GitHub CLI Extensions"
|
||||
"go:Install Go Packages"
|
||||
"imagick:Install ImageMagick CLI"
|
||||
"starship:Install starship.rs"
|
||||
"macos:Setup nice macOS defaults"
|
||||
"nvm:Install Node Version Manager (nvm)"
|
||||
"npm:Install NPM Packages"
|
||||
"ntfy:Install ntfy"
|
||||
"z:Install z"
|
||||
)
|
||||
|
||||
case "$1" in
|
||||
all)
|
||||
@@ -29,7 +48,10 @@ function section_install
|
||||
$0 install starship
|
||||
$0 brew install
|
||||
$0 install composer
|
||||
$0 install dotenv-linter
|
||||
$0 install dotenv
|
||||
$0 install gh
|
||||
$0 install go
|
||||
$0 install imagick
|
||||
$0 install nvm
|
||||
$0 install npm
|
||||
$0 install ntfy
|
||||
@@ -37,100 +59,111 @@ function section_install
|
||||
;;
|
||||
antigen)
|
||||
curl -L git.io/antigen > "$DOTFILES/local/bin/antigen.zsh" \
|
||||
&& msg_done "🎉 New antigen installed!"
|
||||
&& msg_yay "New antigen installed!"
|
||||
;;
|
||||
composer)
|
||||
bash "$DOTFILES/scripts/install-composer.sh" \
|
||||
&& msg_done "🎉 composer installed!"
|
||||
&& msg_yay "composer installed!"
|
||||
;;
|
||||
dotenv-linter)
|
||||
dotenv)
|
||||
curl -sSfL \
|
||||
https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh \
|
||||
| sh -s -- -b "$XDG_BIN_HOME" \
|
||||
&& msg_done "🎉 dotenv-linter installed!"
|
||||
&& msg_yay "dotenv-linter installed!"
|
||||
;;
|
||||
gh)
|
||||
bash "$DOTFILES/scripts/install-gh-extensions.sh" \
|
||||
&& msg_yay "github cli extensions installed!"
|
||||
;;
|
||||
go)
|
||||
bash "$DOTFILES/scripts/install-go-packages.sh" \
|
||||
&& msg_yay "go packages installed!"
|
||||
;;
|
||||
imagick)
|
||||
curl -L https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \
|
||||
&& msg_yay "imagick installed!"
|
||||
;;
|
||||
starship)
|
||||
curl -sS https://starship.rs/install.sh | sh -s -- --bin-dir ~/.local/bin \
|
||||
&& msg_done "🎉 starship installed!"
|
||||
&& msg_yay "starship installed!"
|
||||
;;
|
||||
macos)
|
||||
bash "$DOTFILES/scripts/set-macos-defaults.sh" \
|
||||
&& msg_done "🎉 Brewfile defined apps has been installed!"
|
||||
&& msg_yay "Brewfile defined apps has been installed!"
|
||||
;;
|
||||
nvm)
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \
|
||||
&& git checkout "$HOME/.zshrc" \
|
||||
&& nvm install --lts --latest-npm --default \
|
||||
&& msg_done "🎉 nvm installed!"
|
||||
curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION_NVM/install.sh" | bash \
|
||||
&& nvm install --lts --latest-npm --default
|
||||
git checkout "$DOTFILES/base/zshrc"
|
||||
msg_yay "nvm installed!"
|
||||
;;
|
||||
npm)
|
||||
bash "$DOTFILES/scripts/install-npm-packages.sh" \
|
||||
&& msg_done "🎉 NPM Packages have been installed!"
|
||||
&& msg_yay "NPM Packages have been installed!"
|
||||
;;
|
||||
ntfy)
|
||||
bash "$DOTFILES/scripts/install-ntfy.sh" \
|
||||
&& msg_done "🎉 ntfy installed!"
|
||||
&& msg_yay "ntfy installed!"
|
||||
;;
|
||||
z)
|
||||
bash "$DOTFILES/scripts/install-z.sh" \
|
||||
&& msg_done "🎉 Z has been installed!"
|
||||
&& msg_yay "z has been installed!"
|
||||
;;
|
||||
*)
|
||||
menu_section "$USAGE_PREFIX" "all | antigen | composer | dotenv-linter | starship | macos | nvm | npm"
|
||||
menu_item "all" "Installs macos defaults, antigen, starship, brew, nvm, npm packages and others"
|
||||
menu_item "antigen" "Updates the antigen.zsh file"
|
||||
menu_item "composer" "Install composer"
|
||||
menu_item "dotenv-linter" "Install dotenv-linter"
|
||||
menu_item "starship" "Install starship.rs"
|
||||
menu_item "macos" "Setup nice macOS defaults"
|
||||
menu_item "nvm" "Install Node Version Manager (nvm)"
|
||||
menu_item "npm" "Install NPM Packages"
|
||||
menu_item "ntfy" "Install ntfy"
|
||||
menu_item "z" "Install z"
|
||||
menu_usage "$USAGE_PREFIX" "${MENU[@]}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function section_brew
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT brew"
|
||||
USAGE_PREFIX="$SCRIPT brew <command>"
|
||||
|
||||
if ! command -v brew &> /dev/null; then
|
||||
menu_section "$USAGE_PREFIX" "brew not available on this system"
|
||||
else
|
||||
MENU=(
|
||||
"install:Installs items defined in Brewfile"
|
||||
"update:Updates and upgrades brew packages"
|
||||
"updatebundle:Updates Brewfile with descriptions"
|
||||
"autoupdate:Setups brew auto-update and runs it immediately"
|
||||
)
|
||||
|
||||
have brew && {
|
||||
case "$1" in
|
||||
install)
|
||||
brew bundle install --file="$BREWFILE" && msg_done "🎉 Done!"
|
||||
brew bundle install --file="$BREWFILE" && msg_yay "Done!"
|
||||
;;
|
||||
update)
|
||||
brew update && brew outdated && brew upgrade && brew cleanup
|
||||
msg_done "🎉 Done!"
|
||||
msg_yay "Done!"
|
||||
;;
|
||||
updatebundle)
|
||||
# Updates .dotfiles/Brewfile with descriptions
|
||||
brew bundle dump \
|
||||
--force \
|
||||
--file="$BREWFILE" \
|
||||
--describe && msg_done "🎉 Done!"
|
||||
--describe && msg_yay "Done!"
|
||||
;;
|
||||
autoupdate)
|
||||
brew autoupdate delete
|
||||
brew autoupdate start 43200 --upgrade --cleanup --immediate
|
||||
;;
|
||||
*)
|
||||
menu_section "$USAGE_PREFIX" "install | update | updatebundle | autoupdate"
|
||||
menu_item "install" "Installs items defined in Brewfile"
|
||||
menu_item "update" "Updates and upgrades brew packages"
|
||||
menu_item "updatebundle" "Updates Brewfile with descriptions"
|
||||
menu_item "autoupdate" "Setups brew auto-update and runs it immediately"
|
||||
menu_usage "$USAGE_PREFIX" "${MENU[@]}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
} || menu_section "$USAGE_PREFIX" "brew not available on this system"
|
||||
}
|
||||
|
||||
function section_dotfiles
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT dotfiles"
|
||||
USAGE_PREFIX="$SCRIPT dotfiles <command>"
|
||||
|
||||
MENU=(
|
||||
"fmt:Run all formatters"
|
||||
"yamlfmt:Run yamlfmt to all dotfiles, which are in our control"
|
||||
"shfmt:Run shfmt to all dotfiles"
|
||||
"reset_all:Reset everything, runs all configured reset actions"
|
||||
"reset_nvim:Resets nvim. Deletes caches, removes nvim folders and relinks nvim folders"
|
||||
)
|
||||
|
||||
case "$1" in
|
||||
fmt)
|
||||
@@ -151,16 +184,16 @@ function section_dotfiles
|
||||
~/.config/astronvim \
|
||||
~/.config/nvim
|
||||
msg_ok "Deleted old nvim files"
|
||||
ln -s ~/.dotfiles/config/astronvim ~/.config/astronvim
|
||||
ln -s ~/.dotfiles/config/nvim ~/.config/nvim
|
||||
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
|
||||
have npm && $0 install npm
|
||||
msg_ok "Installed packages"
|
||||
msg_done "nvim reset!"
|
||||
;;
|
||||
yamlfmt)
|
||||
# format yaml files
|
||||
yamlfmt -conf "$DOTFILES/.yamlfmt"
|
||||
have yamlfmt && yamlfmt -conf "$DOTFILES/.yamlfmt" || msg_err "yamlfmt not found"
|
||||
;;
|
||||
shfmt)
|
||||
# Format shell scripts according to following rules.
|
||||
@@ -177,25 +210,25 @@ function section_dotfiles
|
||||
--func-next-line --list --write \
|
||||
--indent 2 --case-indent --space-redirects \
|
||||
--binary-next-line {} \;
|
||||
msg_done "🎉 dotfiles have been shfmt formatted!"
|
||||
msg_yay "dotfiles have been shfmt formatted!"
|
||||
;;
|
||||
*)
|
||||
menu_section "$USAGE_PREFIX" "fmt | reset_all | reset_nvim | yamlfmt | shfmt"
|
||||
menu_item "fmt" "Run all formatters"
|
||||
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"
|
||||
menu_usage "$USAGE_PREFIX" "${MENU[@]}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function section_check
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT check"
|
||||
USAGE_PREFIX="$SCRIPT check <command>"
|
||||
X_HOSTNAME=$(hostname)
|
||||
X_ARCH=$(uname)
|
||||
|
||||
MENU=(
|
||||
"arch <arch>:Empty <arch> returns current. Exit code 0=match to current, 1=no match."
|
||||
"host <host>:Empty <host> returns current. Exit code 0=match to current, 1=no match."
|
||||
)
|
||||
|
||||
case "$1" in
|
||||
a | arch)
|
||||
[[ "$2" = "" ]] && echo "$X_ARCH" && exit 0
|
||||
@@ -206,9 +239,7 @@ function section_check
|
||||
[[ $X_HOSTNAME = "$2" ]] && exit 0 || exit 1
|
||||
;;
|
||||
*)
|
||||
menu_section "$USAGE_PREFIX" "arch | host"
|
||||
menu_item "arch <arch>" "Empty returns current. Exit code 0 when match, 1 when not."
|
||||
menu_item "host <host>" "Empty returns current. Exit code 0 when match, 1 when not."
|
||||
menu_usage "$USAGE_PREFIX" "${MENU[@]}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -216,24 +247,31 @@ function section_check
|
||||
# Secret menu for visual tests
|
||||
function section_tests
|
||||
{
|
||||
USAGE_PREFIX="$SCRIPT tests"
|
||||
USAGE_PREFIX="$SCRIPT tests <command>"
|
||||
|
||||
MENU=(
|
||||
"msg:List all log functions from shared.sh"
|
||||
)
|
||||
|
||||
case "$1" in
|
||||
msg)
|
||||
msg "msg"
|
||||
msg_done "msg_done"
|
||||
msg_prompt "msg_prompt"
|
||||
msg_prompt_done "msg_prompt_done"
|
||||
msg_done_suffix "msg_done_suffix"
|
||||
msg_err "msg_err"
|
||||
msg_nested "msg_nested"
|
||||
msg_nested_done "msg_nested_done"
|
||||
msg_run "msg_run" "second_param"
|
||||
msg_ok "msg_ok"
|
||||
msg_prompt "msg_prompt"
|
||||
msg_prompt_done "msg_prompt_done"
|
||||
msg_run "msg_run" "second_param"
|
||||
msg_run_done "msg_run_done" "second_param"
|
||||
msg_warn "msg_warn"
|
||||
msg_err "msg_err"
|
||||
msg_yay "msg_yay"
|
||||
msg_yay_done "msg_yay_done"
|
||||
;;
|
||||
*)
|
||||
menu_section "$USAGE_PREFIX" "msg"
|
||||
menu_item "msg" "List all log functions from shared.sh"
|
||||
menu_usage "$USAGE_PREFIX" "${MENU[@]}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -241,8 +279,8 @@ function section_tests
|
||||
function usage
|
||||
{
|
||||
echo ""
|
||||
menu_section "Usage: $SCRIPT" "install | reset | brew | check | dotfiles"
|
||||
echo $" All commands have their own subcommands."
|
||||
msg_prompt "Usage: $SCRIPT <section> <command>"
|
||||
echo $" Empty <command> prints <section> help."
|
||||
echo ""
|
||||
section_install
|
||||
echo ""
|
||||
|
||||
57
local/bin/x-compare-versions.py
Executable file
57
local/bin/x-compare-versions.py
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Version Comparison tool for the CLI.
|
||||
|
||||
Adapted from script found in anishathalye's dotfiles.
|
||||
https://github.com/anishathalye/dotfiles/blob/master/bin/vercmp
|
||||
"""
|
||||
|
||||
import operator
|
||||
import sys
|
||||
|
||||
from packaging import version
|
||||
|
||||
str_to_operator = {
|
||||
"==": operator.eq,
|
||||
"!=": operator.ne,
|
||||
"<": operator.lt,
|
||||
"<=": operator.le,
|
||||
">": operator.gt,
|
||||
">=": operator.ge,
|
||||
}
|
||||
|
||||
|
||||
def vercmp(expr):
|
||||
"""Version Comparison function."""
|
||||
words = expr.split()
|
||||
comparisons = [words[i: i + 3] for i in range(0, len(words) - 2, 2)]
|
||||
for left, op_str, right in comparisons:
|
||||
compare_op = str_to_operator[op_str]
|
||||
if not compare_op(version.parse(left), version.parse(right)):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
"""Triggers version comparison if line is provided."""
|
||||
for line in sys.stdin:
|
||||
if not vercmp(line):
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def test():
|
||||
"""Basic functionality tests."""
|
||||
assert not vercmp("1.9 >= 2.4")
|
||||
assert vercmp("2.4 >= 2.4")
|
||||
assert vercmp("2.5 >= 2.4")
|
||||
assert vercmp("3 >= 2.999")
|
||||
assert vercmp("2.9 < 2.9a")
|
||||
assert vercmp("2.9a >= 2.8")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) == 2 and sys.argv[1] == "test":
|
||||
test()
|
||||
else:
|
||||
main()
|
||||
@@ -2,10 +2,12 @@
|
||||
# Verify folder exists, and if it does not, create it.
|
||||
|
||||
dir="$1"
|
||||
|
||||
[ $# -eq 0 ] && { echo "Usage: $0 full/path/to/dir/to/create"; exit 1; }
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
mkdir -p "$dir" && exit 0;
|
||||
fi
|
||||
|
||||
[ $# -eq 0 ] && {
|
||||
echo "Usage: $0 full/path/to/dir/to/create"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ ! -d "$dir" ]; then
|
||||
mkdir -p "$dir" && exit 0
|
||||
fi
|
||||
|
||||
53
local/bin/x-hr
Executable file
53
local/bin/x-hr
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
# Simple script to output a solid line in the terminal
|
||||
# Useful for marking the end of a task in your bash log
|
||||
# Inspired by @LuRsT's script of the same name
|
||||
# Can be called directly, or source'd in *rc file
|
||||
#
|
||||
# Licensed under MIT, (C) Alicia Sykes 2022
|
||||
# See: https://github.com/Lissy93/dotfiles
|
||||
#
|
||||
# Modified by Ismo Vuorinen <https://github.com/ivuorinen> 2023
|
||||
|
||||
# Determine width of terminal
|
||||
hr_col_count="$(tput cols)"
|
||||
if [ -z "${hr_col_count+set}" ] || [ "$hr_col_count" -lt 1 ]; then
|
||||
hr_col_count="${COLUMNS:-80}"
|
||||
fi
|
||||
|
||||
# Colors
|
||||
CLR_RED="\033[1;31m"
|
||||
hr_color="${hr_color:=$CLR_RED}"
|
||||
hr_reset="\033[0m"
|
||||
|
||||
# Prints the HR line
|
||||
hr_draw_char() {
|
||||
local CHAR="$1"
|
||||
local LINE=''
|
||||
LINE=$(printf "%*s" "$((hr_col_count - 2))")
|
||||
LINE="${LINE// /${CHAR}}"
|
||||
echo -e "◀${hr_color}${LINE:0:${hr_col_count}}${hr_reset}▶"
|
||||
}
|
||||
|
||||
# Passes param and calls hr()
|
||||
hr() {
|
||||
for WORD in "${@:--}"; do
|
||||
hr_draw_char "$WORD"
|
||||
done
|
||||
}
|
||||
|
||||
# Determine if file is being run directly or sourced
|
||||
(
|
||||
[[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] \
|
||||
|| [[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" \
|
||||
&& printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] \
|
||||
|| [[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)
|
||||
) && sourced=1 || sourced=0
|
||||
|
||||
# Either instantiate immediately, or set alias for later
|
||||
if [ "$sourced" -eq 0 ]; then
|
||||
[ "$0" == "${BASH_SOURCE[0]}" ] && hr "$@"
|
||||
else
|
||||
export alias hr='hr'
|
||||
fi
|
||||
|
||||
4
local/bin/x-ip
Executable file
4
local/bin/x-ip
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Source: https://github.com/thirtythreeforty/dotfiles/blob/master/bin/extip
|
||||
|
||||
curl icanhazip.com "${@}"
|
||||
39
local/bin/x-thumbgen
Executable file
39
local/bin/x-thumbgen
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
# Generate thumbnails using magick
|
||||
# https://imagemagick.org/script/download.php
|
||||
#
|
||||
# Defaults to current directory creating thumbs with 1000x1000
|
||||
# images with 200px white borders around the original image.
|
||||
#
|
||||
# Defaults can be overridden with ENV variables like this:
|
||||
# $ THMB_BACKGROUND=black x-thumbgen ~/images/
|
||||
#
|
||||
# Created by: Ismo Vuorinen <https://github.com/ivuorinen> 2015
|
||||
|
||||
: "${THMB_SOURCE:=$1}"
|
||||
: "${THMB_BACKGROUND:=white}"
|
||||
: "${THMB_RESIZE:=800x800}"
|
||||
: "${THMB_EXTENT:=1000x1000}"
|
||||
|
||||
[ $# -eq 0 ] && {
|
||||
echo "Usage: $0 /full/path/to/image/folder"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ "$THMB_SOURCE" == "" ] || [ ! -d "$THMB_SOURCE" ]; then
|
||||
THMB_SOURCE=$(pwd)
|
||||
fi
|
||||
|
||||
if command -v magick &> /dev/null; then
|
||||
|
||||
magick \
|
||||
"$THMB_SOURCE/*" \
|
||||
-resize "$THMB_RESIZE" \
|
||||
-background "$THMB_BACKGROUND" \
|
||||
-gravity center \
|
||||
-extent "$THMB_EXTENT" \
|
||||
-set filename:fname '%t_thumb.%e' +adjoin '%[filename:fname]'
|
||||
|
||||
else
|
||||
echo "magick not found in PATH, https://imagemagick.org/script/download.php"
|
||||
fi
|
||||
93
local/bin/x-welcome-banner
Executable file
93
local/bin/x-welcome-banner
Executable file
@@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
######################################################################
|
||||
# 🌞 Welcome Banner #
|
||||
######################################################################
|
||||
# Prints personal greeting, system info and data about today #
|
||||
# Intended for use as a MOTD, for when using multiple systems #
|
||||
# For docs and more info, see: https://github.com/lissy93/dotfiles #
|
||||
# #
|
||||
# Licensed under MIT (C) Alicia Sykes 2022 <https://aliciasykes.com> #
|
||||
######################################################################
|
||||
|
||||
# Formatting variables
|
||||
COLOR_P='\033[1;36m'
|
||||
COLOR_S='\033[0;36m'
|
||||
RESET='\033[0m'
|
||||
|
||||
# Print time-based personalized message, using figlet & lolcat if availible
|
||||
function welcome_greeting () {
|
||||
h=$(date +%H)
|
||||
if [ "$h" -lt 04 ] || [[ $h -gt 22 ]];
|
||||
then greeting="Good Night"
|
||||
elif [ "$h" -lt 12 ];
|
||||
then greeting="Good morning"
|
||||
elif [ "$h" -lt 18 ];
|
||||
then greeting="Good afternoon"
|
||||
elif [ "$h" -lt 22 ];
|
||||
then greeting="Good evening"
|
||||
else
|
||||
greeting="Hello"
|
||||
fi
|
||||
WELCOME_MSG="$greeting $USER!"
|
||||
if hash lolcat 2>/dev/null && hash figlet 2>/dev/null; then
|
||||
echo "${WELCOME_MSG}" | figlet | lolcat
|
||||
else
|
||||
echo -e "$COLOR_P${WELCOME_MSG}${RESET}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
# Print system information with neofetch, if it's installed
|
||||
function welcome_sysinfo () {
|
||||
if hash neofetch 2>/dev/null; then
|
||||
neofetch --shell_version off \
|
||||
--disable kernel distro shell resolution de wm wm_theme theme icons terminal \
|
||||
--backend off \
|
||||
--colors 4 8 4 4 8 6 \
|
||||
--color_blocks off \
|
||||
--memory_display info
|
||||
fi
|
||||
}
|
||||
|
||||
# Print todays info: Date, IP, weather, etc
|
||||
function welcome_today () {
|
||||
timeout=1
|
||||
echo -e "\033[1;34mToday\n------"
|
||||
|
||||
# Print date time
|
||||
echo -e "$COLOR_S$(date '+🗓️ Date: %A, %B %d, %Y at %H:%M')"
|
||||
|
||||
# Print local weather
|
||||
curl -s -m $timeout "https://wttr.in?format=%cWeather:+%C+%t,+%p+%w"
|
||||
echo -e "${RESET}"
|
||||
|
||||
# Print IP address
|
||||
if hash ip 2>/dev/null; then
|
||||
ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
|
||||
ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
|
||||
echo -e "${COLOR_S}🌐 IP: $(curl -s -m $timeout 'https://ipinfo.io/ip') (${ip_address} on ${ip_interface})"
|
||||
echo -e "${RESET}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
# Putting it all together
|
||||
function welcome() {
|
||||
welcome_greeting
|
||||
welcome_sysinfo
|
||||
welcome_today
|
||||
}
|
||||
|
||||
# Determine if file is being run directly or sourced
|
||||
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] \
|
||||
|| [[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" \
|
||||
&& printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] \
|
||||
|| [[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)
|
||||
) && sourced=1 || sourced=0
|
||||
|
||||
# If script being called directly run immediately
|
||||
if [ "$sourced" -eq 0 ]; then
|
||||
welcome "$@"
|
||||
fi
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Install PHP Package Manager Composer
|
||||
#
|
||||
# shellcheck source="shared.sh"
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
if command -v php &> /dev/null; then
|
||||
have php && {
|
||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||
@@ -16,4 +20,4 @@ if command -v php &> /dev/null; then
|
||||
rm composer-setup.php
|
||||
mv composer.phar ~/.local/bin/composer
|
||||
exit $RESULT
|
||||
fi
|
||||
} || msg_err "PHP Not Available, cannot install composer"
|
||||
|
||||
42
scripts/install-gh-extensions.sh
Executable file
42
scripts/install-gh-extensions.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install GitHub CLI extensions
|
||||
#
|
||||
# shellcheck source="shared.sh"
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
have gh && {
|
||||
extensions=(
|
||||
# GitHub CLI extension for generating a report on repository dependencies.
|
||||
andyfeller/gh-dependency-report
|
||||
# GitHub CLI extension to generate montage from GitHub user avatars
|
||||
andyfeller/gh-montage
|
||||
# An opinionated GitHub Cli extension for creating
|
||||
# changelogs that adhere to the keep a changelog specification.
|
||||
chelnak/gh-changelog
|
||||
# Safely deletes local branches with no upstream and no un-pushed commits
|
||||
davidraviv/gh-clean-branches
|
||||
# A beautiful CLI dashboard for GitHub 🚀
|
||||
dlvhdr/gh-dash
|
||||
# A github-cli extension script to clone all repositories
|
||||
# in an organization, optionally filtering by topic.
|
||||
matt-bartel/gh-clone-org
|
||||
# being an extension to view the overall health of
|
||||
# an organization's use of actions
|
||||
rsese/gh-actions-status
|
||||
)
|
||||
|
||||
msg "Starting to install GitHub CLI extensions..."
|
||||
|
||||
for ext in "${extensions[@]}"; do
|
||||
# Trim spaces
|
||||
ext=${ext// /}
|
||||
# Skip comments
|
||||
if [[ ${ext:0:1} == "#" ]]; then continue; fi
|
||||
|
||||
msg_run "Installing $ext"
|
||||
gh extensions install "$ext"
|
||||
echo ""
|
||||
done
|
||||
|
||||
msg_ok "Done"
|
||||
} || msg_err "gh (GitHub Client) could not be found, please install it first"
|
||||
@@ -4,9 +4,7 @@
|
||||
# shellcheck source=shared.sh
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
if ! command -v go &> /dev/null; then
|
||||
msg "go hasn't been installed yet."
|
||||
else
|
||||
have go && {
|
||||
packages=(
|
||||
# sysadmin/scripting utilities, distributed as a single binary
|
||||
github.com/skx/sysbox@latest
|
||||
@@ -14,6 +12,7 @@ else
|
||||
github.com/google/yamlfmt/cmd/yamlfmt@latest
|
||||
github.com/ericchiang/pup@latest
|
||||
github.com/suntong/html2md@latest
|
||||
github.com/cheat/cheat/cmd/cheat@latest
|
||||
)
|
||||
|
||||
for pkg in "${packages[@]}"; do
|
||||
@@ -28,5 +27,4 @@ else
|
||||
done
|
||||
|
||||
msg_ok "Done"
|
||||
|
||||
fi
|
||||
} || msg "go hasn't been installed yet."
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
# shellcheck source=shared.sh
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
if ! command -v npm &> /dev/null; then
|
||||
msg_err "npm could not be found."
|
||||
else
|
||||
have npm && {
|
||||
packages=(
|
||||
# This is a tool to check if your files consider your .editorconfig rules.
|
||||
"editorconfig-checker"
|
||||
@@ -17,7 +15,6 @@ else
|
||||
"prettier"
|
||||
"@bchatard/alfred-jetbrains"
|
||||
"@johnnymorganz/stylua-bin"
|
||||
"js-debug"
|
||||
"stylelint-lsp"
|
||||
"blade-formatter"
|
||||
"@loopback/cli"
|
||||
@@ -31,8 +28,17 @@ else
|
||||
# Skip comments
|
||||
if [[ ${pkg:0:1} == "#" ]]; then continue; fi
|
||||
|
||||
msg_run "Installing npm package:" "$pkg"
|
||||
npm install -g --no-fund --no-progress --no-timing "$pkg"
|
||||
if [[ $(npm ls -g -p "$pkg") != "" ]]; then
|
||||
msg_run_done "$pkg" "already installed"
|
||||
else
|
||||
msg_run "Installing npm package:" "$pkg"
|
||||
npm install -g --no-fund --no-progress --no-timing "$pkg"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
done
|
||||
fi
|
||||
|
||||
msg_run "Upgrading all global packages"
|
||||
npm -g --no-progress --no-timing --no-fund outdated
|
||||
npm -g --no-timing --no-fund upgrade
|
||||
} || msg_err "npm could not be found."
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Install ntfy
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
set -e
|
||||
|
||||
if ! command -v ntfy &> /dev/null; then
|
||||
have ntfy && {
|
||||
msg "ntfy already installed"
|
||||
} || {
|
||||
case $(dfm check arch) in
|
||||
Linux)
|
||||
NTFY_ARCH="linux_$(arch)"
|
||||
@@ -28,6 +34,4 @@ if ! command -v ntfy &> /dev/null; then
|
||||
fi
|
||||
|
||||
rm -rf "${NTFY_DEST}" "${NTFY_DEST}.tar.gz"
|
||||
else
|
||||
echo "ntfy already installed"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Install z
|
||||
#
|
||||
# shellcheck source=shared.sh
|
||||
source "$HOME/.dotfiles/scripts/shared.sh"
|
||||
|
||||
Z_GIT_PATH="https://github.com/rupa/z.git"
|
||||
Z_BIN_PATH="$XDG_BIN_HOME/z"
|
||||
@@ -6,5 +11,5 @@ Z_BIN_PATH="$XDG_BIN_HOME/z"
|
||||
if [ ! -d "$Z_BIN_PATH" ]; then
|
||||
git clone "$Z_GIT_PATH" "$Z_BIN_PATH"
|
||||
else
|
||||
echo "z ($Z_BIN_PATH/) already installed"
|
||||
msg_done "z ($Z_BIN_PATH/) already installed"
|
||||
fi
|
||||
|
||||
@@ -11,6 +11,28 @@ CLR_GREEN="\033[1;32m"
|
||||
CLR_BLUE="\033[1;34m"
|
||||
CLR_RESET="\033[0m"
|
||||
|
||||
# -- Color functions -- #
|
||||
function __color_red()
|
||||
{
|
||||
local MSG="$1"
|
||||
echo -e "${CLR_RED}${MSG}${CLR_RESET}"
|
||||
}
|
||||
function __color_yellow()
|
||||
{
|
||||
local MSG="$1"
|
||||
echo -e "${CLR_YELLOW}${MSG}${CLR_RESET}"
|
||||
}
|
||||
function __color_green()
|
||||
{
|
||||
local MSG="$1"
|
||||
echo -e "${CLR_GREEN}${MSG}${CLR_RESET}"
|
||||
}
|
||||
function __color_blue()
|
||||
{
|
||||
local MSG="$1"
|
||||
echo -e "${CLR_BLUE}${MSG}${CLR_RESET}"
|
||||
}
|
||||
|
||||
# -- Helpers -- #
|
||||
function __log_marker()
|
||||
{
|
||||
@@ -32,6 +54,11 @@ function __log_marker_warn()
|
||||
echo -e "${CLR_YELLOW}⁕${CLR_RESET}"
|
||||
}
|
||||
|
||||
function __log_marker_question()
|
||||
{
|
||||
echo -e "${CLR_YELLOW}?${CLR_RESET}"
|
||||
}
|
||||
|
||||
function __log_marker_err()
|
||||
{
|
||||
echo -e "${CLR_RED}⛌${CLR_RESET}"
|
||||
@@ -48,19 +75,34 @@ function msg()
|
||||
echo -e "$(__log_marker) $1"
|
||||
}
|
||||
|
||||
function msg_yay()
|
||||
{
|
||||
echo -e "🎉 $1"
|
||||
}
|
||||
|
||||
function msg_yay_done()
|
||||
{
|
||||
echo -e "🎉 $1 ...$(__log_marker_ok)"
|
||||
}
|
||||
|
||||
function msg_done()
|
||||
{
|
||||
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
|
||||
}
|
||||
|
||||
function msg_done_suffix()
|
||||
{
|
||||
echo -e "$(__log_marker) ...$(__log_marker_ok)"
|
||||
}
|
||||
|
||||
function msg_prompt()
|
||||
{
|
||||
echo -e "$(__log_marker) $1"
|
||||
echo -e "$(__log_marker_question) $1"
|
||||
}
|
||||
|
||||
function msg_prompt_done()
|
||||
{
|
||||
echo -e "$(__log_marker) $1 ...$(__log_marker_ok)"
|
||||
echo -e "$(__log_marker_question) $1 ...$(__log_marker_ok)"
|
||||
}
|
||||
|
||||
function msg_nested()
|
||||
@@ -78,6 +120,11 @@ function msg_run()
|
||||
echo -e "${CLR_GREEN}➜ $1${CLR_RESET} $2"
|
||||
}
|
||||
|
||||
function msg_run_done()
|
||||
{
|
||||
echo -e "${CLR_GREEN}➜ $1${CLR_RESET} $2 ...$(__log_marker_ok)"
|
||||
}
|
||||
|
||||
function msg_ok()
|
||||
{
|
||||
echo -e "$(__log_marker_ok) $1"
|
||||
@@ -111,3 +158,69 @@ function fn_exists()
|
||||
declare -f -F "$1" > /dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# Takes a bash array ("cow:moo", "dinosaur:roar") and loops
|
||||
# through the keys to build menu section listing.
|
||||
function menu_usage_header()
|
||||
{
|
||||
MENU_CMD="$1"
|
||||
shift
|
||||
MENU_ARRAY=("$@")
|
||||
|
||||
KEYS=""
|
||||
for item in "${MENU_ARRAY[@]}"; do
|
||||
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
||||
KEYS+="${CMD} | "
|
||||
done
|
||||
|
||||
# "???" removes 3 last characters, being " | " from the end
|
||||
menu_section "$MENU_CMD" "${KEYS%???}"
|
||||
}
|
||||
|
||||
# Takes the usage command "$0 dotfiles" and a
|
||||
# bash array ("cow:moo" "dinosaur:roar") and loops
|
||||
# through in building a menu for dfm command usage listing.
|
||||
function menu_usage()
|
||||
{
|
||||
MENU_CMD="$1"
|
||||
shift
|
||||
MENU_ARRAY=("$@")
|
||||
|
||||
msg "$MENU_CMD"
|
||||
|
||||
for item in "${MENU_ARRAY[@]}"; do
|
||||
CMD=$(echo "${item}" | awk -F ":" '{print $1}')
|
||||
DESC=$(echo "${item}" | awk -F ":" '{print $2}')
|
||||
menu_item "$CMD" "$DESC"
|
||||
done
|
||||
}
|
||||
|
||||
# shorthand for checking if the system has the bin in path.
|
||||
# usage: have php && php -v
|
||||
function have
|
||||
{
|
||||
command -v "$1" >&/dev/null
|
||||
}
|
||||
|
||||
# Remove directory from the PATH variable
|
||||
# usage: path_remove ~/.local/bin
|
||||
function path_remove
|
||||
{
|
||||
PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$1\"" | sed 's/:$//')
|
||||
}
|
||||
|
||||
# Append directory to the PATH
|
||||
# usage: path_append ~/.local/bin
|
||||
function path_append
|
||||
{
|
||||
path_remove "$1"
|
||||
PATH="${PATH:+"$PATH:"}$1"
|
||||
}
|
||||
|
||||
# Prepend directory to the PATH
|
||||
# usage: path_prepend ~/.local/bin
|
||||
function path_prepend
|
||||
{
|
||||
path_remove "$1"
|
||||
PATH="$1${PATH:+":$PATH"}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user