@sebastienrousseau/dotfiles 0.2.469 → 0.2.481
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +285 -0
- package/README.md +236 -319
- package/docs/ALIASES.md +128 -0
- package/docs/ARCHITECTURE.md +229 -0
- package/docs/COMPLIANCE.md +47 -0
- package/docs/COPYRIGHT +7 -0
- package/docs/FEATURES.md +166 -0
- package/docs/FONTS.md +147 -0
- package/docs/INSTALL.md +119 -0
- package/docs/KEYS.md +40 -0
- package/docs/KEY_ROTATION.md +219 -0
- package/docs/LEGACY_ROADMAP.md +142 -0
- package/docs/NEOVIM_IDE_GUIDE.md +52 -0
- package/docs/OPERATIONS.md +130 -0
- package/docs/PLAN.md +161 -0
- package/docs/PR_DESCRIPTION.md +149 -0
- package/docs/README.md +269 -0
- package/docs/REPO_AUDIT.md +23 -0
- package/docs/ROADMAP.md +148 -0
- package/docs/SCREENSHOTS.md +116 -0
- package/docs/SECRETS.md +76 -0
- package/docs/SECURITY.md +30 -0
- package/docs/SECURITY_CHECKLIST.md +25 -0
- package/docs/TASK.md +99 -0
- package/docs/TESTING.md +190 -0
- package/docs/TOOLS.md +146 -0
- package/docs/TROUBLESHOOTING.md +112 -0
- package/docs/UTILS.md +105 -0
- package/docs/WALKTHROUGH.md +165 -0
- package/docs/WSL2_NIX_TROUBLESHOOTING.md +723 -0
- package/docs/adr/ADR-001-ci-cd-pipeline.md +101 -0
- package/docs/adr/ADR-002-shell-performance.md +121 -0
- package/docs/adr/ADR-003-security-first.md +140 -0
- package/docs/adr/ADR-004-cli-architecture.md +157 -0
- package/docs/adr/ADR-005-chezmoi-choice.md +89 -0
- package/docs/adr/ADR-006-shell-selection.md +115 -0
- package/docs/adr/README.md +33 -0
- package/docs/themes/README.md +20 -0
- package/dot_config/aider/aider.conf.yml +32 -0
- package/dot_config/alacritty/alacritty.toml.tmpl +483 -0
- package/dot_config/ansible/ansible.cfg.tmpl +11 -0
- package/dot_config/atuin/config.toml +23 -0
- package/dot_config/bat/config +8 -0
- package/dot_config/brave-flags.conf.tmpl +7 -0
- package/dot_config/btop/btop.conf +16 -0
- package/dot_config/btop/themes/tokyonight.theme +34 -0
- package/dot_config/bun/bunfig.toml.tmpl +33 -0
- package/dot_config/claude/mcp_servers.json +49 -0
- package/dot_config/clippy.toml +55 -0
- package/dot_config/containers/containers.conf +14 -0
- package/dot_config/curl/dot_curlrc +18 -0
- package/dot_config/dlv/config.yml +39 -0
- package/dot_config/docker/config.json.tmpl +15 -0
- package/dot_config/dotfiles/boot/README.md +11 -0
- package/dot_config/dotfiles/grub/README.md +11 -0
- package/dot_config/dotfiles/lock/README.md +11 -0
- package/dot_config/dotfiles/versions.env.tmpl +19 -0
- package/dot_config/duf/duf.conf +6 -0
- package/dot_config/duti/defaults.duti +5 -0
- package/dot_config/emoji/emoji.txt +34 -0
- package/dot_config/fastfetch/config.jsonc +28 -0
- package/dot_config/firefox/user.js +8 -0
- package/dot_config/flatpak/flatpak.list +4 -0
- package/dot_config/fontconfig/fonts.conf.tmpl +44 -0
- package/dot_config/gh/config.yml +12 -0
- package/dot_config/ghostty/config.tmpl +661 -0
- package/dot_config/git/attributes +12 -0
- package/dot_config/git/config.tmpl +77 -0
- package/dot_config/git/ignore +27 -0
- package/dot_config/gnupg/gpg-agent.conf.tmpl +11 -0
- package/dot_config/go/aliases.sh +61 -0
- package/dot_config/go/env.sh +24 -0
- package/dot_config/go/golangci.yml +118 -0
- package/dot_config/go/gopls.json +30 -0
- package/dot_config/goose/config.yaml +29 -0
- package/dot_config/gtk-3.0/gtk.css.tmpl +305 -0
- package/dot_config/gtk-3.0/settings.ini.tmpl +66 -0
- package/dot_config/gtk-4.0/gtk.css.tmpl +309 -0
- package/dot_config/gtk-4.0/settings.ini.tmpl +21 -0
- package/dot_config/htop/htoprc +20 -0
- package/dot_config/ice/README.md +13 -0
- package/dot_config/inputrc +2 -0
- package/dot_config/ipython/profile_default/ipython_config.py.tmpl +5 -0
- package/dot_config/just/justfile +104 -0
- package/dot_config/k9s/config.yaml.tmpl +65 -0
- package/dot_config/k9s/skins/catppuccin-mocha.yaml +116 -0
- package/dot_config/karabiner/karabiner.json +14 -0
- package/dot_config/kitty/kitty.conf.tmpl +517 -0
- package/dot_config/lazydocker/config.yml +186 -0
- package/dot_config/lazygit/config.yml +23 -0
- package/dot_config/lsd/config.yaml +19 -0
- package/dot_config/mas/masapps.txt +5 -0
- package/dot_config/minikube/config.json +13 -0
- package/dot_config/mise/config.toml +41 -0
- package/dot_config/mongosh/mongoshrc.js +67 -0
- package/dot_config/mycli/myclirc +67 -0
- package/dot_config/nano/nanorc +28 -0
- package/dot_config/ncdu/config +12 -0
- package/dot_config/nvim/init.lua +4 -0
- package/dot_config/nvim/lazy-lock.json +27 -0
- package/dot_config/nvim/lua/config/autocmds.lua +63 -0
- package/dot_config/nvim/lua/config/keymaps.lua +87 -0
- package/dot_config/nvim/lua/config/lazy.lua +34 -0
- package/dot_config/nvim/lua/config/options.lua +48 -0
- package/dot_config/nvim/lua/plugins/coding.lua +234 -0
- package/dot_config/nvim/lua/plugins/dap.lua +201 -0
- package/dot_config/nvim/lua/plugins/editor.lua +59 -0
- package/dot_config/nvim/lua/plugins/git.lua +9 -0
- package/dot_config/nvim/lua/plugins/lsp.lua +221 -0
- package/dot_config/nvim/lua/plugins/markdown.lua +17 -0
- package/dot_config/nvim/lua/plugins/rust.lua +33 -0
- package/dot_config/nvim/lua/plugins/sessions.lua +32 -0
- package/dot_config/nvim/lua/plugins/ui.lua +537 -0
- package/dot_config/nvim/snippets/all.lua +9 -0
- package/dot_config/nvim/snippets/python.lua +16 -0
- package/dot_config/pip/pip.conf.tmpl +32 -0
- package/dot_config/pypoetry/config.toml.tmpl +6 -0
- package/dot_config/pyrightconfig.json.tmpl +5 -0
- package/dot_config/raycast/README.md +13 -0
- package/dot_config/redis/redisclirc +41 -0
- package/dot_config/shell/00-container-detect.sh +53 -0
- package/dot_config/shell/00-core-paths.sh.tmpl +95 -0
- package/dot_config/shell/05-core-safety.sh.tmpl +13 -0
- package/dot_config/shell/40-ls-colors.sh.tmpl +31 -0
- package/dot_config/shell/50-logic-functions.sh.tmpl +10 -0
- package/dot_config/shell/90-theme-switch.sh +70 -0
- package/dot_config/shell/90-ux-aliases.sh.tmpl +35 -0
- package/dot_config/shell/91-ux-aliases-lazy.sh.tmpl +23 -0
- package/dot_config/shell/Brewfile +207 -0
- package/dot_config/shell/Brewfile.cask +92 -0
- package/dot_config/shell/Brewfile.cli +119 -0
- package/dot_config/shell/README.md +267 -0
- package/dot_config/shell/custom/context_suggest.zsh +68 -0
- package/dot_config/shell/custom/error_analysis.zsh +45 -0
- package/dot_config/sops/dot_sops.yaml +23 -0
- package/dot_config/starship.toml.tmpl +124 -0
- package/dot_config/task/Taskfile.yml +86 -0
- package/dot_config/tflint/tflint.hcl.tmpl +9 -0
- package/dot_config/tmux/tmux.conf.tmpl +181 -0
- package/dot_config/topgrade/topgrade.toml.tmpl +42 -0
- package/dot_config/vscode/extensions.txt +11 -0
- package/dot_config/vscode/settings.json.tmpl +123 -0
- package/dot_config/waybar/style.css +8 -0
- package/dot_config/wezterm/wezterm.lua.tmpl +236 -0
- package/dot_config/wget/wgetrc +12 -0
- package/dot_config/yarn/yarnrc.yml.tmpl +36 -0
- package/dot_config/yazi/yazi.toml +40 -0
- package/dot_config/zellij/config.kdl +79 -0
- package/dot_config/zsh/dot_zprofile +13 -0
- package/dot_config/zsh/dot_zshenv +6 -0
- package/dot_config/zsh/dot_zshrc.tmpl +199 -0
- package/dot_config/zsh/rc.d/05-ssh-agent.zsh +5 -0
- package/dot_config/zsh/rc.d/10-env.zsh.tmpl +28 -0
- package/dot_config/zsh/rc.d/20-zinit.zsh.tmpl +22 -0
- package/dot_config/zsh/rc.d/30-options.zsh.tmpl +123 -0
- package/dot_config/zsh/rc.d/40-bell.zsh.tmpl +20 -0
- package/dot_config/zsh/rc.d/50-login-fortune.zsh.tmpl +9 -0
- package/dot_local/bin/executable_ai_core +130 -0
- package/dot_local/bin/executable_b64 +59 -0
- package/dot_local/bin/executable_dot +178 -0
- package/dot_local/bin/executable_dot_completion +55 -0
- package/dot_local/bin/executable_epoch +62 -0
- package/dot_local/bin/executable_extract +108 -0
- package/dot_local/bin/executable_git-ai-commit +160 -0
- package/dot_local/bin/executable_git-ai-diff +154 -0
- package/dot_local/bin/executable_hash +123 -0
- package/dot_local/bin/executable_hex +79 -0
- package/dot_local/bin/executable_ip +37 -0
- package/dot_local/bin/executable_jsonv +54 -0
- package/dot_local/bin/executable_jwt +78 -0
- package/dot_local/bin/executable_kill-port +59 -0
- package/dot_local/bin/executable_lorem +103 -0
- package/dot_local/bin/executable_regex +96 -0
- package/dot_local/bin/executable_tmux-sessionizer +187 -0
- package/dot_local/bin/executable_tour +137 -0
- package/dot_local/bin/executable_update +108 -0
- package/dot_local/bin/executable_uuid +57 -0
- package/dot_local/bin/executable_yamlv +39 -0
- package/dot_local/bin/executable_zig-install +89 -0
- package/dot_local/bin/voice_ops +7 -0
- package/dot_local/share/bash-completion/completions/dot +54 -0
- package/dot_local/share/zsh/completions/.keep +0 -0
- package/install.sh +255 -0
- package/package.json +52 -76
- package/scripts/ci/validate-ci-config.sh +222 -0
- package/scripts/demo/record.sh +41 -0
- package/scripts/diagnostics/benchmark.sh +201 -0
- package/scripts/diagnostics/doctor.sh +115 -0
- package/scripts/diagnostics/drift-dashboard.sh +26 -0
- package/scripts/diagnostics/health.sh +356 -0
- package/scripts/diagnostics/history-analysis.sh +77 -0
- package/scripts/diagnostics/security-score.sh +392 -0
- package/scripts/diagnostics/verify_state.sh +60 -0
- package/scripts/dot/commands/appearance.sh +63 -0
- package/scripts/dot/commands/core.sh +130 -0
- package/scripts/dot/commands/diagnostics.sh +100 -0
- package/scripts/dot/commands/meta.sh +117 -0
- package/scripts/dot/commands/restore.sh +209 -0
- package/scripts/dot/commands/secrets.sh +81 -0
- package/scripts/dot/commands/security.sh +73 -0
- package/scripts/dot/commands/tools.sh +228 -0
- package/scripts/dot/lib/utils.sh +72 -0
- package/scripts/fonts/install-nerd-fonts.sh +59 -0
- package/scripts/fonts/patch-fonts.sh +34 -0
- package/scripts/ops/chezmoi-apply.sh +42 -0
- package/scripts/ops/chezmoi-diff.sh +14 -0
- package/scripts/ops/chezmoi-remove.sh +43 -0
- package/scripts/ops/chezmoi-update.sh +16 -0
- package/scripts/ops/heal.sh +466 -0
- package/scripts/ops/health-check.sh +380 -0
- package/scripts/ops/rollback.sh +531 -0
- package/scripts/ops/teleport.sh +32 -0
- package/scripts/secrets/age-init.sh +69 -0
- package/scripts/secrets/create-secrets-file.sh +44 -0
- package/scripts/secrets/encrypt-ssh-key.sh +42 -0
- package/scripts/security/backup.sh +17 -0
- package/scripts/security/dns-doh.sh +29 -0
- package/scripts/security/encryption-check.sh +39 -0
- package/scripts/security/enforce-policies.sh +339 -0
- package/scripts/security/firewall.sh +34 -0
- package/scripts/security/lock-configs.sh +57 -0
- package/scripts/security/lock-screen.sh +33 -0
- package/scripts/security/manage-secrets.sh +415 -0
- package/scripts/security/telemetry-kill.sh +28 -0
- package/scripts/security/usb-safety.sh +29 -0
- package/scripts/tests/README.md +241 -0
- package/scripts/tests/benchmark.sh +91 -0
- package/scripts/tests/framework/assertions.sh +283 -0
- package/scripts/tests/framework/mocks.sh +201 -0
- package/scripts/tests/framework/test_runner.sh +189 -0
- package/scripts/tests/integration/test_install.sh +237 -0
- package/scripts/tests/performance/benchmark_runner.sh +156 -0
- package/scripts/tests/performance/regression_check.sh +73 -0
- package/scripts/tests/performance/stress_test.sh +65 -0
- package/scripts/tests/test-aliases.sh +25 -0
- package/scripts/tests/test-docker.sh +48 -0
- package/scripts/tests/unit/test_ai_aliases.sh +158 -0
- package/scripts/tests/unit/test_ai_cli_checks.sh +47 -0
- package/scripts/tests/unit/test_backup.sh +227 -0
- package/scripts/tests/unit/test_case_functions.sh +238 -0
- package/scripts/tests/unit/test_cd_aliases.sh +367 -0
- package/scripts/tests/unit/test_dot_cli.sh +217 -0
- package/scripts/tests/unit/test_encode64.sh +67 -0
- package/scripts/tests/unit/test_environment.sh +78 -0
- package/scripts/tests/unit/test_extract.sh +163 -0
- package/scripts/tests/unit/test_framework_edge_cases.sh +113 -0
- package/scripts/tests/unit/test_genpass.sh +298 -0
- package/scripts/tests/unit/test_install_edge_cases.sh +167 -0
- package/scripts/tests/unit/test_installers.sh +172 -0
- package/scripts/tests/unit/test_keygen.sh +68 -0
- package/scripts/tests/unit/test_logging.sh +96 -0
- package/scripts/tests/unit/test_os_detection_comprehensive.sh +388 -0
- package/scripts/tests/unit/test_package_managers_comprehensive.sh +321 -0
- package/scripts/tests/unit/test_prependpath.sh +66 -0
- package/scripts/tests/unit/test_prependpath_refactored.sh +89 -0
- package/scripts/tests/unit/test_rd.sh +230 -0
- package/scripts/tests/unit/test_security_fixes.sh +130 -0
- package/scripts/tests/unit/test_security_scripts.sh +87 -0
- package/scripts/tests/unit/test_template_validation.sh +238 -0
- package/scripts/tests/unit/test_utility_functions.sh +144 -0
- package/scripts/tests/unit/test_wave1_alias_split.sh +132 -0
- package/scripts/tests/unit/test_wave1_ci_pinning.sh +61 -0
- package/scripts/tests/unit/test_wave1_gitleaks_config.sh +52 -0
- package/scripts/tests/unit/test_wave1_heal_fixes.sh +97 -0
- package/scripts/tests/unit/test_wave1_install_gpg.sh +35 -0
- package/scripts/tests/unit/test_wave1_zshenv_path.sh +89 -0
- package/scripts/tests/unit/test_wave1_zshrc_lazy_hook.sh +115 -0
- package/scripts/tests/unit/test_wave2_dot_new_guard.sh +75 -0
- package/scripts/tests/unit/test_zipf.sh +76 -0
- package/scripts/theme/apply-gnome-theme.sh +297 -0
- package/scripts/theme/install-boot-logo.sh +61 -0
- package/scripts/theme/install-catppuccin-themes.sh +346 -0
- package/scripts/theme/install-cursors.sh +24 -0
- package/scripts/theme/install-file-icons.sh +25 -0
- package/scripts/theme/install-grub-theme.sh +51 -0
- package/scripts/theme/install-lock-icon.sh +29 -0
- package/scripts/theme/switch.sh +250 -0
- package/scripts/theme/wallpaper-rotate.sh +82 -0
- package/scripts/theme/wallpaper-sync.sh +42 -0
- package/scripts/tools/cmatrix.sh +20 -0
- package/scripts/tools/detect-collisions.py +84 -0
- package/scripts/tools/emoji-picker.sh +45 -0
- package/scripts/tools/figlet-banner.sh +17 -0
- package/scripts/tools/log-rotate.sh +29 -0
- package/scripts/tools/lolcat-wrap.sh +18 -0
- package/scripts/tools/pipes.sh +47 -0
- package/scripts/tuning/linux.sh +175 -0
- package/scripts/tuning/macos.sh +46 -0
- package/templates/projects/go/README.md +7 -0
- package/templates/projects/go/cmd/__PROJECT_NAME__/main.go +7 -0
- package/templates/projects/go/go.mod +3 -0
- package/templates/projects/molecule/README.md +7 -0
- package/templates/projects/molecule/converge.yml +7 -0
- package/templates/projects/molecule/molecule.yml +16 -0
- package/templates/projects/node/README.md +7 -0
- package/templates/projects/node/package.json +10 -0
- package/templates/projects/node/src/index.js +2 -0
- package/templates/projects/packer/README.md +15 -0
- package/templates/projects/packer/main.pkr.hcl +15 -0
- package/templates/projects/python/README.md +7 -0
- package/templates/projects/python/pyproject.toml +25 -0
- package/templates/projects/python/src/__PROJECT_NAME__/__init__.py +1 -0
- package/templates/projects/python/tests/test_basic.py +2 -0
- package/dist/Makefile +0 -140
- package/dist/bin/backup.d.ts +0 -3
- package/dist/bin/backup.d.ts.map +0 -1
- package/dist/bin/backup.js +0 -4
- package/dist/bin/backup.js.map +0 -1
- package/dist/bin/constants.d.ts +0 -7
- package/dist/bin/constants.d.ts.map +0 -1
- package/dist/bin/constants.js +0 -2
- package/dist/bin/constants.js.map +0 -1
- package/dist/bin/copy.d.ts +0 -3
- package/dist/bin/copy.d.ts.map +0 -1
- package/dist/bin/copy.js +0 -3
- package/dist/bin/copy.js.map +0 -1
- package/dist/bin/dotfiles.d.ts +0 -3
- package/dist/bin/dotfiles.d.ts.map +0 -1
- package/dist/bin/dotfiles.js +0 -2
- package/dist/bin/dotfiles.js.map +0 -1
- package/dist/bin/download.d.ts +0 -3
- package/dist/bin/download.d.ts.map +0 -1
- package/dist/bin/download.js +0 -2
- package/dist/bin/download.js.map +0 -1
- package/dist/bin/index.d.ts +0 -2
- package/dist/bin/index.d.ts.map +0 -1
- package/dist/bin/index.js +0 -1
- package/dist/bin/index.js.map +0 -1
- package/dist/bin/transfer.d.ts +0 -3
- package/dist/bin/transfer.d.ts.map +0 -1
- package/dist/bin/transfer.js +0 -4
- package/dist/bin/transfer.js.map +0 -1
- package/dist/bin/unpack.d.ts +0 -3
- package/dist/bin/unpack.d.ts.map +0 -1
- package/dist/bin/unpack.js +0 -3
- package/dist/bin/unpack.js.map +0 -1
- package/dist/filesizes.txt +0 -382
- package/dist/lib/README.md +0 -86
- package/dist/lib/aliases/README.md +0 -57
- package/dist/lib/aliases/archives/README.md +0 -145
- package/dist/lib/aliases/archives/archives.aliases.sh +0 -114
- package/dist/lib/aliases/cd/README.md +0 -146
- package/dist/lib/aliases/cd/cd.aliases.sh +0 -51
- package/dist/lib/aliases/chmod/README.md +0 -160
- package/dist/lib/aliases/chmod/chmod.aliases.sh +0 -107
- package/dist/lib/aliases/clear/README.md +0 -37
- package/dist/lib/aliases/clear/clear.aliases.sh +0 -71
- package/dist/lib/aliases/configuration/README.md +0 -39
- package/dist/lib/aliases/configuration/configuration.aliases.sh +0 -70
- package/dist/lib/aliases/default/README.md +0 -40
- package/dist/lib/aliases/default/default.aliases.sh +0 -139
- package/dist/lib/aliases/dig/README.md +0 -37
- package/dist/lib/aliases/dig/dig.aliases.sh +0 -43
- package/dist/lib/aliases/disk-usage/README.md +0 -36
- package/dist/lib/aliases/disk-usage/du.aliases.sh +0 -84
- package/dist/lib/aliases/editor/README.md +0 -53
- package/dist/lib/aliases/editor/editor.aliases.sh +0 -26
- package/dist/lib/aliases/find/README.md +0 -46
- package/dist/lib/aliases/find/find.aliases.sh +0 -60
- package/dist/lib/aliases/gcloud/README.md +0 -63
- package/dist/lib/aliases/gcloud/gcloud.aliases.sh +0 -335
- package/dist/lib/aliases/git/README.md +0 -153
- package/dist/lib/aliases/git/git.aliases.sh +0 -544
- package/dist/lib/aliases/gnu/README.md +0 -89
- package/dist/lib/aliases/gnu/gnucoreutils-aliases.sh +0 -150
- package/dist/lib/aliases/heroku/README.md +0 -430
- package/dist/lib/aliases/heroku/heroku.aliases.sh +0 -1053
- package/dist/lib/aliases/interactive/README.md +0 -55
- package/dist/lib/aliases/interactive/interactive.aliases.sh +0 -50
- package/dist/lib/aliases/list/README.md +0 -131
- package/dist/lib/aliases/list/list.aliases.sh +0 -132
- package/dist/lib/aliases/macOS/README.md +0 -42
- package/dist/lib/aliases/macOS/macos.aliases.sh +0 -65
- package/dist/lib/aliases/make/README.md +0 -32
- package/dist/lib/aliases/make/make.aliases.sh +0 -35
- package/dist/lib/aliases/mkdir/README.md +0 -30
- package/dist/lib/aliases/mkdir/mkdir.aliases.sh +0 -29
- package/dist/lib/aliases/npm/README.md +0 -41
- package/dist/lib/aliases/npm/npm.aliases.sh +0 -61
- package/dist/lib/aliases/permission/README.md +0 -47
- package/dist/lib/aliases/permission/permission.aliases.sh +0 -73
- package/dist/lib/aliases/pnpm/README.md +0 -53
- package/dist/lib/aliases/pnpm/pnpm.aliases.sh +0 -76
- package/dist/lib/aliases/ps/README.md +0 -29
- package/dist/lib/aliases/ps/ps.aliases.sh +0 -20
- package/dist/lib/aliases/python/python.aliases.sh +0 -141
- package/dist/lib/aliases/rsync/README.md +0 -25
- package/dist/lib/aliases/rsync/rsync.aliases.sh +0 -17
- package/dist/lib/aliases/rust/README.md +0 -182
- package/dist/lib/aliases/rust/rust.aliases.sh +0 -119
- package/dist/lib/aliases/subversion/README.md +0 -66
- package/dist/lib/aliases/subversion/subversion.aliases.sh +0 -47
- package/dist/lib/aliases/sudo/README.md +0 -27
- package/dist/lib/aliases/sudo/sudo.aliases.sh +0 -20
- package/dist/lib/aliases/tmux/README.md +0 -31
- package/dist/lib/aliases/tmux/tmux.aliases.sh +0 -36
- package/dist/lib/aliases/update/README.md +0 -38
- package/dist/lib/aliases/update/update.aliases.sh +0 -310
- package/dist/lib/aliases/uuid/README.md +0 -24
- package/dist/lib/aliases/uuid/uuid.aliases.sh +0 -19
- package/dist/lib/aliases/wget/README.md +0 -27
- package/dist/lib/aliases/wget/wget.aliases.sh +0 -22
- package/dist/lib/aliases.sh +0 -50
- package/dist/lib/configurations/README.md +0 -18
- package/dist/lib/configurations/bash/bashrc +0 -167
- package/dist/lib/configurations/curl/cacert.pem +0 -3460
- package/dist/lib/configurations/curl/curlrc +0 -53
- package/dist/lib/configurations/default/color.sh +0 -24
- package/dist/lib/configurations/default/constants.sh +0 -43
- package/dist/lib/configurations/default/editor.sh +0 -18
- package/dist/lib/configurations/default/prompt.sh +0 -48
- package/dist/lib/configurations/input/inputrc +0 -23
- package/dist/lib/configurations/jshint/jshintrc +0 -37
- package/dist/lib/configurations/nano/nanorc +0 -35
- package/dist/lib/configurations/profile/profile +0 -37
- package/dist/lib/configurations/prompt/prompt.sh +0 -81
- package/dist/lib/configurations/tmux/default +0 -18
- package/dist/lib/configurations/tmux/display +0 -30
- package/dist/lib/configurations/tmux/linux +0 -18
- package/dist/lib/configurations/tmux/navigation +0 -30
- package/dist/lib/configurations/tmux/panes +0 -10
- package/dist/lib/configurations/tmux/theme +0 -29
- package/dist/lib/configurations/tmux/tmux +0 -21
- package/dist/lib/configurations/vim/vimrc +0 -193
- package/dist/lib/configurations/wget/wgetrc +0 -40
- package/dist/lib/configurations/zsh/zshrc +0 -50
- package/dist/lib/configurations.sh +0 -45
- package/dist/lib/functions/README.md +0 -92
- package/dist/lib/functions/apihealth.sh +0 -277
- package/dist/lib/functions/apilatency.sh +0 -157
- package/dist/lib/functions/apiload.sh +0 -165
- package/dist/lib/functions/backup.sh +0 -143
- package/dist/lib/functions/cdls.sh +0 -60
- package/dist/lib/functions/curlheader.sh +0 -78
- package/dist/lib/functions/curlstatus.sh +0 -74
- package/dist/lib/functions/curltime.sh +0 -75
- package/dist/lib/functions/encode64.sh +0 -107
- package/dist/lib/functions/environment.sh +0 -78
- package/dist/lib/functions/extract.sh +0 -86
- package/dist/lib/functions/freespace.sh +0 -67
- package/dist/lib/functions/genpwd.sh +0 -105
- package/dist/lib/functions/goto.sh +0 -67
- package/dist/lib/functions/hexdump.sh +0 -96
- package/dist/lib/functions/hiddenfiles.sh +0 -77
- package/dist/lib/functions/hostinfo.sh +0 -98
- package/dist/lib/functions/hstats.sh +0 -75
- package/dist/lib/functions/httpdebug.sh +0 -113
- package/dist/lib/functions/kebabcase.sh +0 -61
- package/dist/lib/functions/keygen.sh +0 -194
- package/dist/lib/functions/last.sh +0 -112
- package/dist/lib/functions/logout.sh +0 -120
- package/dist/lib/functions/lowercase.sh +0 -61
- package/dist/lib/functions/matrix.sh +0 -216
- package/dist/lib/functions/mount_read_only.sh +0 -11
- package/dist/lib/functions/myproc.sh +0 -9
- package/dist/lib/functions/prependpath.sh +0 -21
- package/dist/lib/functions/ql.sh +0 -9
- package/dist/lib/functions/rd.sh +0 -17
- package/dist/lib/functions/remove_disk.sh +0 -11
- package/dist/lib/functions/ren.sh +0 -73
- package/dist/lib/functions/sentencecase.sh +0 -63
- package/dist/lib/functions/showhiddenfiles.sh +0 -14
- package/dist/lib/functions/size.sh +0 -16
- package/dist/lib/functions/snakecase.sh +0 -61
- package/dist/lib/functions/stopwatch.sh +0 -15
- package/dist/lib/functions/sysinfo.sh +0 -145
- package/dist/lib/functions/titlecase.sh +0 -65
- package/dist/lib/functions/uppercase.sh +0 -61
- package/dist/lib/functions/view-source.sh +0 -9
- package/dist/lib/functions/vscode.sh +0 -32
- package/dist/lib/functions/whoisport.sh +0 -14
- package/dist/lib/functions/zipf.sh +0 -16
- package/dist/lib/functions.sh +0 -46
- package/dist/lib/history.sh +0 -90
- package/dist/lib/paths/README.md +0 -52
- package/dist/lib/paths/custom.paths.sh +0 -40
- package/dist/lib/paths/default.paths.sh +0 -37
- package/dist/lib/paths.sh +0 -46
- package/dist/scripts/backup.sh +0 -95
- package/dist/scripts/banner.sh +0 -20
- package/dist/scripts/build.sh +0 -41
- package/dist/scripts/clean.sh +0 -31
- package/dist/scripts/compile.sh +0 -54
- package/dist/scripts/copy.sh +0 -108
- package/dist/scripts/dotfiles.sh +0 -63
- package/dist/scripts/download.sh +0 -35
- package/dist/scripts/help.sh +0 -57
- package/dist/scripts/ssh.sh +0 -55
- package/dist/scripts/unpack.sh +0 -28
- /package/{dist/lib/configurations → dot_config}/gem/gemrc +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# JSON validator and formatter
|
|
3
|
+
# Usage: jsonv <file> | jsonv (reads stdin) | jsonv --format <file>
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
FORMAT=false
|
|
8
|
+
QUIET=false
|
|
9
|
+
|
|
10
|
+
while [[ $# -gt 0 ]]; do
|
|
11
|
+
case "$1" in
|
|
12
|
+
-f|--format) FORMAT=true; shift ;;
|
|
13
|
+
-q|--quiet) QUIET=true; shift ;;
|
|
14
|
+
-*) echo "Unknown option: $1"; exit 1 ;;
|
|
15
|
+
*) break ;;
|
|
16
|
+
esac
|
|
17
|
+
done
|
|
18
|
+
|
|
19
|
+
validate_json() {
|
|
20
|
+
local input="$1"
|
|
21
|
+
if command -v jq >/dev/null 2>&1; then
|
|
22
|
+
if $FORMAT; then
|
|
23
|
+
jq '.' <<< "$input"
|
|
24
|
+
else
|
|
25
|
+
jq -e '.' <<< "$input" >/dev/null 2>&1
|
|
26
|
+
fi
|
|
27
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
28
|
+
if $FORMAT; then
|
|
29
|
+
python3 -m json.tool <<< "$input"
|
|
30
|
+
else
|
|
31
|
+
python3 -c "import json; json.loads('''$input''')" 2>/dev/null
|
|
32
|
+
fi
|
|
33
|
+
else
|
|
34
|
+
echo "Error: jq or python3 required"
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Read input
|
|
40
|
+
if [[ $# -gt 0 ]] && [[ -f "$1" ]]; then
|
|
41
|
+
INPUT=$(cat "$1")
|
|
42
|
+
SOURCE="$1"
|
|
43
|
+
else
|
|
44
|
+
INPUT=$(cat)
|
|
45
|
+
SOURCE="stdin"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
if validate_json "$INPUT"; then
|
|
49
|
+
$QUIET || echo "✓ Valid JSON ($SOURCE)"
|
|
50
|
+
exit 0
|
|
51
|
+
else
|
|
52
|
+
echo "✗ Invalid JSON ($SOURCE)"
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# JWT token decoder
|
|
3
|
+
# Usage: jwt <token> | jwt (reads from stdin)
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
decode_base64url() {
|
|
8
|
+
local input="$1"
|
|
9
|
+
# Add padding
|
|
10
|
+
local mod=$((${#input} % 4))
|
|
11
|
+
if [[ $mod -eq 2 ]]; then input="${input}=="; fi
|
|
12
|
+
if [[ $mod -eq 3 ]]; then input="${input}="; fi
|
|
13
|
+
# Convert URL-safe to standard base64
|
|
14
|
+
echo "$input" | tr '-_' '+/' | base64 -d 2>/dev/null || base64 -D <<< "$(echo "$input" | tr '-_' '+/')"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
format_json() {
|
|
18
|
+
if command -v jq >/dev/null 2>&1; then
|
|
19
|
+
jq '.' 2>/dev/null || cat
|
|
20
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
21
|
+
python3 -m json.tool 2>/dev/null || cat
|
|
22
|
+
else
|
|
23
|
+
cat
|
|
24
|
+
fi
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# Get token
|
|
28
|
+
if [[ $# -gt 0 ]]; then
|
|
29
|
+
TOKEN="$1"
|
|
30
|
+
else
|
|
31
|
+
read -r TOKEN
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Remove 'Bearer ' prefix if present
|
|
35
|
+
TOKEN="${TOKEN#Bearer }"
|
|
36
|
+
TOKEN="${TOKEN#bearer }"
|
|
37
|
+
|
|
38
|
+
# Split into parts
|
|
39
|
+
IFS='.' read -ra PARTS <<< "$TOKEN"
|
|
40
|
+
|
|
41
|
+
if [[ ${#PARTS[@]} -lt 2 ]]; then
|
|
42
|
+
echo "Error: Invalid JWT format"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
echo "=== Header ==="
|
|
47
|
+
decode_base64url "${PARTS[0]}" | format_json
|
|
48
|
+
echo ""
|
|
49
|
+
|
|
50
|
+
echo "=== Payload ==="
|
|
51
|
+
PAYLOAD=$(decode_base64url "${PARTS[1]}")
|
|
52
|
+
echo "$PAYLOAD" | format_json
|
|
53
|
+
echo ""
|
|
54
|
+
|
|
55
|
+
# Check expiration
|
|
56
|
+
if command -v jq >/dev/null 2>&1; then
|
|
57
|
+
EXP=$(echo "$PAYLOAD" | jq -r '.exp // empty' 2>/dev/null)
|
|
58
|
+
IAT=$(echo "$PAYLOAD" | jq -r '.iat // empty' 2>/dev/null)
|
|
59
|
+
|
|
60
|
+
if [[ -n "$EXP" ]]; then
|
|
61
|
+
NOW=$(date +%s)
|
|
62
|
+
EXP_DATE=$(date -d "@$EXP" 2>/dev/null || date -r "$EXP" 2>/dev/null)
|
|
63
|
+
if [[ $EXP -lt $NOW ]]; then
|
|
64
|
+
echo "⚠️ Token EXPIRED at: $EXP_DATE"
|
|
65
|
+
else
|
|
66
|
+
echo "✓ Token expires at: $EXP_DATE"
|
|
67
|
+
fi
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
if [[ -n "$IAT" ]]; then
|
|
71
|
+
IAT_DATE=$(date -d "@$IAT" 2>/dev/null || date -r "$IAT" 2>/dev/null)
|
|
72
|
+
echo " Issued at: $IAT_DATE"
|
|
73
|
+
fi
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
echo ""
|
|
77
|
+
echo "=== Signature ==="
|
|
78
|
+
echo "(${#PARTS[2]} characters, verification requires secret key)"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Kill process running on specified port
|
|
3
|
+
# Usage: kill-port <port> [--force]
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
if [[ $# -lt 1 ]]; then
|
|
8
|
+
echo "Usage: kill-port <port> [--force]"
|
|
9
|
+
echo "Example: kill-port 3000"
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
PORT="$1"
|
|
14
|
+
FORCE=false
|
|
15
|
+
[[ "${2:-}" == "--force" || "${2:-}" == "-f" ]] && FORCE=true
|
|
16
|
+
|
|
17
|
+
# Validate port number
|
|
18
|
+
if ! [[ "$PORT" =~ ^[0-9]+$ ]] || [[ "$PORT" -lt 1 ]] || [[ "$PORT" -gt 65535 ]]; then
|
|
19
|
+
echo "Error: Invalid port number: $PORT"
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Find process using the port
|
|
24
|
+
find_pid() {
|
|
25
|
+
if command -v lsof >/dev/null 2>&1; then
|
|
26
|
+
lsof -ti ":$PORT" 2>/dev/null
|
|
27
|
+
elif command -v ss >/dev/null 2>&1; then
|
|
28
|
+
ss -tlnp "sport = :$PORT" 2>/dev/null | awk 'NR>1 {match($0, /pid=([0-9]+)/, a); print a[1]}'
|
|
29
|
+
elif command -v netstat >/dev/null 2>&1; then
|
|
30
|
+
netstat -tlnp 2>/dev/null | awk -v port=":$PORT" '$4 ~ port {split($7, a, "/"); print a[1]}'
|
|
31
|
+
else
|
|
32
|
+
echo "Error: No supported tool found (lsof, ss, or netstat required)"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
PIDS=$(find_pid)
|
|
38
|
+
|
|
39
|
+
if [[ -z "$PIDS" ]]; then
|
|
40
|
+
echo "No process found on port $PORT"
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
echo "Found process(es) on port $PORT:"
|
|
45
|
+
for pid in $PIDS; do
|
|
46
|
+
ps -p "$pid" -o pid,comm,args --no-headers 2>/dev/null || echo " PID: $pid"
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
if $FORCE; then
|
|
50
|
+
SIGNAL="-9"
|
|
51
|
+
echo "Force killing..."
|
|
52
|
+
else
|
|
53
|
+
SIGNAL="-15"
|
|
54
|
+
echo "Sending SIGTERM..."
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
for pid in $PIDS; do
|
|
58
|
+
kill $SIGNAL "$pid" 2>/dev/null && echo "Killed PID $pid" || echo "Failed to kill PID $pid"
|
|
59
|
+
done
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lorem ipsum text generator
|
|
3
|
+
# Usage: lorem [words|sentences|paragraphs] [count]
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
# Lorem ipsum word pool
|
|
8
|
+
WORDS=(
|
|
9
|
+
"lorem" "ipsum" "dolor" "sit" "amet" "consectetur" "adipiscing" "elit"
|
|
10
|
+
"sed" "do" "eiusmod" "tempor" "incididunt" "ut" "labore" "et" "dolore"
|
|
11
|
+
"magna" "aliqua" "enim" "ad" "minim" "veniam" "quis" "nostrud"
|
|
12
|
+
"exercitation" "ullamco" "laboris" "nisi" "aliquip" "ex" "ea" "commodo"
|
|
13
|
+
"consequat" "duis" "aute" "irure" "in" "reprehenderit" "voluptate"
|
|
14
|
+
"velit" "esse" "cillum" "fugiat" "nulla" "pariatur" "excepteur" "sint"
|
|
15
|
+
"occaecat" "cupidatat" "non" "proident" "sunt" "culpa" "qui" "officia"
|
|
16
|
+
"deserunt" "mollit" "anim" "id" "est" "laborum" "perspiciatis" "unde"
|
|
17
|
+
"omnis" "iste" "natus" "error" "voluptatem" "accusantium" "doloremque"
|
|
18
|
+
"laudantium" "totam" "rem" "aperiam" "eaque" "ipsa" "quae" "ab" "illo"
|
|
19
|
+
"inventore" "veritatis" "quasi" "architecto" "beatae" "vitae" "dicta"
|
|
20
|
+
"explicabo" "nemo" "ipsam" "quia" "voluptas" "aspernatur" "aut" "odit"
|
|
21
|
+
"fugit" "consequuntur" "magni" "dolores" "eos" "ratione" "sequi"
|
|
22
|
+
"nesciunt" "neque" "porro" "quisquam" "dolorem" "adipisci" "numquam"
|
|
23
|
+
"eius" "modi" "tempora" "incidunt" "magnam" "quaerat"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
random_word() {
|
|
27
|
+
echo "${WORDS[$RANDOM % ${#WORDS[@]}]}"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
generate_sentence() {
|
|
31
|
+
local word_count=$((RANDOM % 10 + 5))
|
|
32
|
+
local sentence=""
|
|
33
|
+
for ((i = 0; i < word_count; i++)); do
|
|
34
|
+
if [[ $i -eq 0 ]]; then
|
|
35
|
+
word=$(random_word)
|
|
36
|
+
sentence="${word^}"
|
|
37
|
+
else
|
|
38
|
+
sentence="$sentence $(random_word)"
|
|
39
|
+
fi
|
|
40
|
+
done
|
|
41
|
+
echo "$sentence."
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
generate_paragraph() {
|
|
45
|
+
local sentence_count=$((RANDOM % 4 + 3))
|
|
46
|
+
local paragraph=""
|
|
47
|
+
for ((i = 0; i < sentence_count; i++)); do
|
|
48
|
+
if [[ $i -eq 0 ]]; then
|
|
49
|
+
paragraph=$(generate_sentence)
|
|
50
|
+
else
|
|
51
|
+
paragraph="$paragraph $(generate_sentence)"
|
|
52
|
+
fi
|
|
53
|
+
done
|
|
54
|
+
echo "$paragraph"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Parse arguments
|
|
58
|
+
TYPE="${1:-paragraphs}"
|
|
59
|
+
COUNT="${2:-1}"
|
|
60
|
+
|
|
61
|
+
case "$TYPE" in
|
|
62
|
+
w|word|words)
|
|
63
|
+
for ((i = 0; i < COUNT; i++)); do
|
|
64
|
+
if [[ $i -eq 0 ]]; then
|
|
65
|
+
word=$(random_word)
|
|
66
|
+
echo -n "${word^}"
|
|
67
|
+
else
|
|
68
|
+
echo -n " $(random_word)"
|
|
69
|
+
fi
|
|
70
|
+
done
|
|
71
|
+
echo
|
|
72
|
+
;;
|
|
73
|
+
s|sentence|sentences)
|
|
74
|
+
for ((i = 0; i < COUNT; i++)); do
|
|
75
|
+
generate_sentence
|
|
76
|
+
done
|
|
77
|
+
;;
|
|
78
|
+
p|paragraph|paragraphs)
|
|
79
|
+
for ((i = 0; i < COUNT; i++)); do
|
|
80
|
+
generate_paragraph
|
|
81
|
+
[[ $i -lt $((COUNT - 1)) ]] && echo
|
|
82
|
+
done
|
|
83
|
+
;;
|
|
84
|
+
-h|--help)
|
|
85
|
+
echo "Usage: lorem [type] [count]"
|
|
86
|
+
echo ""
|
|
87
|
+
echo "Types:"
|
|
88
|
+
echo " words, w Generate words"
|
|
89
|
+
echo " sentences, s Generate sentences"
|
|
90
|
+
echo " paragraphs, p Generate paragraphs (default)"
|
|
91
|
+
echo ""
|
|
92
|
+
echo "Examples:"
|
|
93
|
+
echo " lorem # 1 paragraph"
|
|
94
|
+
echo " lorem p 3 # 3 paragraphs"
|
|
95
|
+
echo " lorem words 10 # 10 words"
|
|
96
|
+
echo " lorem sentences 5 # 5 sentences"
|
|
97
|
+
;;
|
|
98
|
+
*)
|
|
99
|
+
echo "Unknown type: $TYPE"
|
|
100
|
+
echo "Use: words, sentences, or paragraphs"
|
|
101
|
+
exit 1
|
|
102
|
+
;;
|
|
103
|
+
esac
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Regex tester
|
|
3
|
+
# Usage: regex <pattern> <string> | regex -f <pattern> <file>
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
usage() {
|
|
8
|
+
echo "Usage: regex [OPTIONS] <pattern> [string|file]"
|
|
9
|
+
echo ""
|
|
10
|
+
echo "Options:"
|
|
11
|
+
echo " -f, --file Test against file contents"
|
|
12
|
+
echo " -g, --global Find all matches"
|
|
13
|
+
echo " -i, --ignore Case insensitive"
|
|
14
|
+
echo " -m, --multiline Multiline mode"
|
|
15
|
+
echo " -c, --color Colorize matches"
|
|
16
|
+
echo " -h, --help Show this help"
|
|
17
|
+
echo ""
|
|
18
|
+
echo "Examples:"
|
|
19
|
+
echo " regex '[0-9]+' 'abc123def' # Test pattern"
|
|
20
|
+
echo " regex -g '[a-z]+' 'hello world' # Find all"
|
|
21
|
+
echo " regex -f '^#' config.txt # Test file"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
FILE_MODE=false
|
|
25
|
+
GLOBAL=false
|
|
26
|
+
IGNORE_CASE=""
|
|
27
|
+
COLOR=true
|
|
28
|
+
|
|
29
|
+
while [[ $# -gt 0 ]]; do
|
|
30
|
+
case "$1" in
|
|
31
|
+
-f|--file) FILE_MODE=true; shift ;;
|
|
32
|
+
-g|--global) GLOBAL=true; shift ;;
|
|
33
|
+
-i|--ignore) IGNORE_CASE="-i"; shift ;;
|
|
34
|
+
-c|--color) COLOR=true; shift ;;
|
|
35
|
+
--no-color) COLOR=false; shift ;;
|
|
36
|
+
-h|--help) usage; exit 0 ;;
|
|
37
|
+
-*) echo "Unknown option: $1"; usage; exit 1 ;;
|
|
38
|
+
*) break ;;
|
|
39
|
+
esac
|
|
40
|
+
done
|
|
41
|
+
|
|
42
|
+
if [[ $# -lt 1 ]]; then
|
|
43
|
+
usage
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
PATTERN="$1"
|
|
48
|
+
shift
|
|
49
|
+
|
|
50
|
+
# Get input
|
|
51
|
+
if $FILE_MODE; then
|
|
52
|
+
if [[ $# -lt 1 ]] || [[ ! -f "$1" ]]; then
|
|
53
|
+
echo "Error: File required for -f mode"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
INPUT=$(cat "$1")
|
|
57
|
+
elif [[ $# -gt 0 ]]; then
|
|
58
|
+
INPUT="$*"
|
|
59
|
+
else
|
|
60
|
+
INPUT=$(cat)
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Color settings
|
|
64
|
+
if $COLOR; then
|
|
65
|
+
GREP_COLOR="--color=always"
|
|
66
|
+
else
|
|
67
|
+
GREP_COLOR="--color=never"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# Test and show matches
|
|
71
|
+
echo "Pattern: $PATTERN"
|
|
72
|
+
echo "---"
|
|
73
|
+
|
|
74
|
+
if $GLOBAL; then
|
|
75
|
+
# Find all matches
|
|
76
|
+
if echo "$INPUT" | grep -oE $IGNORE_CASE "$PATTERN" $GREP_COLOR; then
|
|
77
|
+
echo "---"
|
|
78
|
+
MATCH_COUNT=$(echo "$INPUT" | grep -oE $IGNORE_CASE "$PATTERN" | wc -l)
|
|
79
|
+
echo "✓ Found $MATCH_COUNT match(es)"
|
|
80
|
+
else
|
|
81
|
+
echo "✗ No matches found"
|
|
82
|
+
exit 1
|
|
83
|
+
fi
|
|
84
|
+
else
|
|
85
|
+
# Test if pattern matches
|
|
86
|
+
if echo "$INPUT" | grep -qE $IGNORE_CASE "$PATTERN"; then
|
|
87
|
+
echo "$INPUT" | grep -E $IGNORE_CASE "$PATTERN" $GREP_COLOR
|
|
88
|
+
echo "---"
|
|
89
|
+
echo "✓ Pattern matches"
|
|
90
|
+
else
|
|
91
|
+
echo "$INPUT"
|
|
92
|
+
echo "---"
|
|
93
|
+
echo "✗ Pattern does not match"
|
|
94
|
+
exit 1
|
|
95
|
+
fi
|
|
96
|
+
fi
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# tmux-sessionizer - Fuzzy session switcher for tmux
|
|
3
|
+
#
|
|
4
|
+
# This script provides a fuzzy-finder interface for switching between
|
|
5
|
+
# tmux sessions and creating new sessions from project directories.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# tmux-sessionizer [directory]
|
|
9
|
+
#
|
|
10
|
+
# If no directory is provided, uses fzf to select from:
|
|
11
|
+
# - Existing tmux sessions
|
|
12
|
+
# - Project directories from configured paths
|
|
13
|
+
#
|
|
14
|
+
# Configuration:
|
|
15
|
+
# Set TMUX_SESSIONIZER_DIRS to customise search paths (colon-separated)
|
|
16
|
+
# Default: ~/projects:~/work:~/src:~/.dotfiles
|
|
17
|
+
#
|
|
18
|
+
# References:
|
|
19
|
+
# - ThePrimeagen's original: https://github.com/ThePrimeagen/.dotfiles
|
|
20
|
+
|
|
21
|
+
set -euo pipefail
|
|
22
|
+
|
|
23
|
+
# Configuration
|
|
24
|
+
SESSIONIZER_DIRS="${TMUX_SESSIONIZER_DIRS:-$HOME/projects:$HOME/work:$HOME/src:$HOME/.dotfiles}"
|
|
25
|
+
|
|
26
|
+
# Colours for output
|
|
27
|
+
readonly RED='\033[0;31m'
|
|
28
|
+
readonly GREEN='\033[0;32m'
|
|
29
|
+
readonly NC='\033[0m' # No Colour
|
|
30
|
+
|
|
31
|
+
log_error() {
|
|
32
|
+
echo -e "${RED}Error:${NC} $1" >&2
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
log_info() {
|
|
36
|
+
echo -e "${GREEN}Info:${NC} $1"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Check dependencies
|
|
40
|
+
if ! command -v fzf &>/dev/null; then
|
|
41
|
+
log_error "fzf is required but not installed."
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
if ! command -v tmux &>/dev/null; then
|
|
46
|
+
log_error "tmux is required but not installed."
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Get list of directories to search (as newline-separated list for safe iteration)
|
|
51
|
+
get_search_dirs() {
|
|
52
|
+
local paths
|
|
53
|
+
IFS=':' read -ra paths <<< "$SESSIONIZER_DIRS"
|
|
54
|
+
for path in "${paths[@]}"; do
|
|
55
|
+
# Expand tilde
|
|
56
|
+
local expanded_path="${path/#\~/$HOME}"
|
|
57
|
+
if [[ -d "$expanded_path" ]]; then
|
|
58
|
+
printf '%s\n' "$expanded_path"
|
|
59
|
+
fi
|
|
60
|
+
done
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Get list of project directories
|
|
64
|
+
get_projects() {
|
|
65
|
+
local search_dirs
|
|
66
|
+
search_dirs=$(get_search_dirs)
|
|
67
|
+
|
|
68
|
+
if [[ -z "$search_dirs" ]]; then
|
|
69
|
+
return
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Find directories (1-2 levels deep) - iterate safely over newline-separated dirs
|
|
73
|
+
while IFS= read -r dir; do
|
|
74
|
+
find "$dir" -mindepth 1 -maxdepth 2 -type d 2>/dev/null
|
|
75
|
+
done <<< "$search_dirs" | sort -u
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# Get list of existing tmux sessions
|
|
79
|
+
get_sessions() {
|
|
80
|
+
tmux list-sessions -F "#{session_name}" 2>/dev/null || true
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Format session name from directory path (sanitized for tmux)
|
|
84
|
+
format_session_name() {
|
|
85
|
+
local dir="$1"
|
|
86
|
+
local name
|
|
87
|
+
|
|
88
|
+
# Get basename, replace dots with underscores, and strip unsafe chars
|
|
89
|
+
name=$(basename "$dir" | tr '.' '_' | tr -cd '[:alnum:]._-')
|
|
90
|
+
|
|
91
|
+
# Remove leading numbers/dashes for cleaner names
|
|
92
|
+
name="${name##[0-9_-]}"
|
|
93
|
+
name="${name##[0-9_-]}"
|
|
94
|
+
name="${name##[0-9_-]}"
|
|
95
|
+
|
|
96
|
+
# If name is empty after cleanup, use sanitized full basename
|
|
97
|
+
if [[ -z "$name" ]]; then
|
|
98
|
+
name=$(basename "$dir" | tr -cd '[:alnum:]._-')
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Limit length for safety
|
|
102
|
+
echo "${name:0:32}"
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
# Switch to or create a tmux session
|
|
106
|
+
switch_to_session() {
|
|
107
|
+
local selected="$1"
|
|
108
|
+
local session_name
|
|
109
|
+
|
|
110
|
+
if [[ -z "$selected" ]]; then
|
|
111
|
+
log_error "No selection made."
|
|
112
|
+
exit 0
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Check if selection is an existing session
|
|
116
|
+
if tmux has-session -t="$selected" 2>/dev/null; then
|
|
117
|
+
session_name="$selected"
|
|
118
|
+
else
|
|
119
|
+
# It's a directory - create or switch to session
|
|
120
|
+
if [[ ! -d "$selected" ]]; then
|
|
121
|
+
log_error "Directory does not exist: $selected"
|
|
122
|
+
exit 1
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
session_name=$(format_session_name "$selected")
|
|
126
|
+
|
|
127
|
+
# Create session if it doesn't exist
|
|
128
|
+
if ! tmux has-session -t="$session_name" 2>/dev/null; then
|
|
129
|
+
tmux new-session -ds "$session_name" -c "$selected"
|
|
130
|
+
log_info "Created new session: $session_name"
|
|
131
|
+
fi
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# Switch to the session
|
|
135
|
+
if [[ -z "${TMUX:-}" ]]; then
|
|
136
|
+
# Not inside tmux - attach directly
|
|
137
|
+
tmux attach-session -t "$session_name"
|
|
138
|
+
else
|
|
139
|
+
# Inside tmux - switch client
|
|
140
|
+
tmux switch-client -t "$session_name"
|
|
141
|
+
fi
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
# Main function
|
|
145
|
+
main() {
|
|
146
|
+
local selected
|
|
147
|
+
|
|
148
|
+
# If argument provided, use it directly
|
|
149
|
+
if [[ $# -eq 1 ]]; then
|
|
150
|
+
selected="$1"
|
|
151
|
+
else
|
|
152
|
+
# Build selection list: existing sessions + project directories
|
|
153
|
+
local sessions projects combined
|
|
154
|
+
|
|
155
|
+
sessions=$(get_sessions)
|
|
156
|
+
projects=$(get_projects)
|
|
157
|
+
|
|
158
|
+
# Combine and deduplicate
|
|
159
|
+
if [[ -n "$sessions" ]] && [[ -n "$projects" ]]; then
|
|
160
|
+
combined=$(printf "%s\n%s" "$sessions" "$projects" | sort -u)
|
|
161
|
+
elif [[ -n "$sessions" ]]; then
|
|
162
|
+
combined="$sessions"
|
|
163
|
+
elif [[ -n "$projects" ]]; then
|
|
164
|
+
combined="$projects"
|
|
165
|
+
else
|
|
166
|
+
log_error "No sessions or project directories found."
|
|
167
|
+
exit 1
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Use fzf for selection
|
|
171
|
+
selected=$(echo "$combined" | fzf \
|
|
172
|
+
--height=50% \
|
|
173
|
+
--layout=reverse \
|
|
174
|
+
--border=rounded \
|
|
175
|
+
--prompt="Session > " \
|
|
176
|
+
--header="Select a session or directory" \
|
|
177
|
+
--preview='if [ -d {} ]; then ls -la {}; else tmux capture-pane -pt {} -p 2>/dev/null | head -20; fi' \
|
|
178
|
+
--preview-window=right:50%:wrap \
|
|
179
|
+
--bind='ctrl-d:preview-page-down' \
|
|
180
|
+
--bind='ctrl-u:preview-page-up' \
|
|
181
|
+
) || exit 0
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
switch_to_session "$selected"
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
main "$@"
|