@fredlackey/devutils 0.0.1 → 0.0.3
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/README.md +5 -5
- package/package.json +1 -1
- package/src/commands/install.js +374 -36
- package/src/installs/adobe-creative-cloud.js +527 -25
- package/src/installs/adobe-creative-cloud.md +605 -0
- package/src/installs/appcleaner.js +303 -26
- package/src/installs/appcleaner.md +699 -0
- package/src/installs/apt-transport-https.js +390 -0
- package/src/installs/apt-transport-https.md +678 -0
- package/src/installs/atomicparsley.js +624 -26
- package/src/installs/atomicparsley.md +795 -0
- package/src/installs/aws-cli.js +779 -26
- package/src/installs/aws-cli.md +727 -0
- package/src/installs/balena-etcher.js +688 -26
- package/src/installs/balena-etcher.md +761 -0
- package/src/installs/bambu-studio.js +912 -26
- package/src/installs/bambu-studio.md +780 -0
- package/src/installs/bash-completion.js +554 -23
- package/src/installs/bash-completion.md +833 -0
- package/src/installs/bash.js +399 -26
- package/src/installs/bash.md +993 -0
- package/src/installs/beyond-compare.js +585 -26
- package/src/installs/beyond-compare.md +813 -0
- package/src/installs/build-essential.js +511 -26
- package/src/installs/build-essential.md +977 -0
- package/src/installs/ca-certificates.js +618 -0
- package/src/installs/ca-certificates.md +937 -0
- package/src/installs/caffeine.js +490 -26
- package/src/installs/caffeine.md +839 -0
- package/src/installs/camtasia.js +577 -25
- package/src/installs/camtasia.md +762 -0
- package/src/installs/chatgpt.js +458 -26
- package/src/installs/chatgpt.md +814 -0
- package/src/installs/chocolatey.js +447 -0
- package/src/installs/chocolatey.md +661 -0
- package/src/installs/chrome-canary.js +472 -26
- package/src/installs/chrome-canary.md +641 -0
- package/src/installs/chromium.js +645 -26
- package/src/installs/chromium.md +838 -0
- package/src/installs/claude-code.js +558 -26
- package/src/installs/claude-code.md +1173 -0
- package/src/installs/curl.js +361 -26
- package/src/installs/curl.md +714 -0
- package/src/installs/cursor.js +561 -26
- package/src/installs/cursor.md +970 -0
- package/src/installs/dbschema.js +674 -26
- package/src/installs/dbschema.md +925 -0
- package/src/installs/dependencies.md +435 -0
- package/src/installs/development-tools.js +600 -0
- package/src/installs/development-tools.md +977 -0
- package/src/installs/docker.js +1010 -25
- package/src/installs/docker.md +1109 -0
- package/src/installs/drawio.js +1001 -26
- package/src/installs/drawio.md +795 -0
- package/src/installs/elmedia-player.js +328 -25
- package/src/installs/elmedia-player.md +556 -0
- package/src/installs/ffmpeg.js +870 -25
- package/src/installs/ffmpeg.md +852 -0
- package/src/installs/file.js +464 -0
- package/src/installs/file.md +987 -0
- package/src/installs/gemini-cli.js +793 -26
- package/src/installs/gemini-cli.md +1153 -0
- package/src/installs/git.js +382 -26
- package/src/installs/git.md +907 -0
- package/src/installs/gitego.js +931 -26
- package/src/installs/gitego.md +1172 -0
- package/src/installs/go.js +913 -26
- package/src/installs/go.md +958 -0
- package/src/installs/google-chrome.js +801 -25
- package/src/installs/google-chrome.md +862 -0
- package/src/installs/gpg.js +412 -73
- package/src/installs/gpg.md +1056 -0
- package/src/installs/homebrew.js +1015 -26
- package/src/installs/homebrew.md +988 -0
- package/src/installs/imageoptim.js +950 -26
- package/src/installs/imageoptim.md +1119 -0
- package/src/installs/installers.json +2297 -0
- package/src/installs/jq.js +382 -26
- package/src/installs/jq.md +809 -0
- package/src/installs/keyboard-maestro.js +701 -26
- package/src/installs/keyboard-maestro.md +825 -0
- package/src/installs/latex.js +771 -26
- package/src/installs/latex.md +1095 -0
- package/src/installs/lftp.js +338 -26
- package/src/installs/lftp.md +907 -0
- package/src/installs/lsb-release.js +346 -0
- package/src/installs/lsb-release.md +814 -0
- package/src/installs/messenger.js +829 -26
- package/src/installs/messenger.md +900 -0
- package/src/installs/microsoft-office.js +550 -26
- package/src/installs/microsoft-office.md +760 -0
- package/src/installs/microsoft-teams.js +782 -25
- package/src/installs/microsoft-teams.md +886 -0
- package/src/installs/node.js +886 -26
- package/src/installs/node.md +1153 -0
- package/src/installs/nordpass.js +698 -26
- package/src/installs/nordpass.md +921 -0
- package/src/installs/nvm.js +977 -26
- package/src/installs/nvm.md +1057 -0
- package/src/installs/openssh.js +734 -64
- package/src/installs/openssh.md +1056 -0
- package/src/installs/pandoc.js +644 -26
- package/src/installs/pandoc.md +1036 -0
- package/src/installs/pinentry.js +492 -26
- package/src/installs/pinentry.md +1142 -0
- package/src/installs/pngyu.js +851 -26
- package/src/installs/pngyu.md +896 -0
- package/src/installs/postman.js +781 -26
- package/src/installs/postman.md +940 -0
- package/src/installs/procps.js +425 -0
- package/src/installs/procps.md +851 -0
- package/src/installs/safari-tech-preview.js +355 -25
- package/src/installs/safari-tech-preview.md +533 -0
- package/src/installs/sfnt2woff.js +640 -26
- package/src/installs/sfnt2woff.md +795 -0
- package/src/installs/shellcheck.js +463 -26
- package/src/installs/shellcheck.md +1005 -0
- package/src/installs/slack.js +722 -25
- package/src/installs/slack.md +865 -0
- package/src/installs/snagit.js +566 -25
- package/src/installs/snagit.md +844 -0
- package/src/installs/software-properties-common.js +372 -0
- package/src/installs/software-properties-common.md +805 -0
- package/src/installs/spotify.js +858 -25
- package/src/installs/spotify.md +901 -0
- package/src/installs/studio-3t.js +803 -26
- package/src/installs/studio-3t.md +918 -0
- package/src/installs/sublime-text.js +780 -25
- package/src/installs/sublime-text.md +914 -0
- package/src/installs/superwhisper.js +687 -25
- package/src/installs/superwhisper.md +630 -0
- package/src/installs/tailscale.js +727 -26
- package/src/installs/tailscale.md +1100 -0
- package/src/installs/tar.js +389 -0
- package/src/installs/tar.md +946 -0
- package/src/installs/termius.js +780 -26
- package/src/installs/termius.md +844 -0
- package/src/installs/terraform.js +761 -26
- package/src/installs/terraform.md +899 -0
- package/src/installs/tidal.js +752 -25
- package/src/installs/tidal.md +864 -0
- package/src/installs/tmux.js +328 -26
- package/src/installs/tmux.md +1030 -0
- package/src/installs/tree.js +393 -26
- package/src/installs/tree.md +833 -0
- package/src/installs/unzip.js +460 -0
- package/src/installs/unzip.md +879 -0
- package/src/installs/vim.js +403 -26
- package/src/installs/vim.md +1040 -0
- package/src/installs/vlc.js +803 -26
- package/src/installs/vlc.md +927 -0
- package/src/installs/vscode.js +825 -26
- package/src/installs/vscode.md +1002 -0
- package/src/installs/wget.js +415 -0
- package/src/installs/wget.md +791 -0
- package/src/installs/whatsapp.js +710 -25
- package/src/installs/whatsapp.md +854 -0
- package/src/installs/winpty.js +352 -0
- package/src/installs/winpty.md +620 -0
- package/src/installs/woff2.js +535 -26
- package/src/installs/woff2.md +977 -0
- package/src/installs/wsl.js +572 -0
- package/src/installs/wsl.md +699 -0
- package/src/installs/xcode-clt.js +520 -0
- package/src/installs/xcode-clt.md +351 -0
- package/src/installs/xcode.js +542 -26
- package/src/installs/xcode.md +573 -0
- package/src/installs/yarn.js +806 -26
- package/src/installs/yarn.md +1074 -0
- package/src/installs/yq.js +636 -26
- package/src/installs/yq.md +944 -0
- package/src/installs/yt-dlp.js +683 -26
- package/src/installs/yt-dlp.md +946 -0
- package/src/installs/yum-utils.js +297 -0
- package/src/installs/yum-utils.md +648 -0
- package/src/installs/zoom.js +740 -25
- package/src/installs/zoom.md +884 -0
- package/src/scripts/README.md +567 -45
- package/src/scripts/STATUS.md +208 -0
- package/src/scripts/afk.js +395 -7
- package/src/scripts/backup-all.js +731 -9
- package/src/scripts/backup-source.js +711 -8
- package/src/scripts/brewd.js +373 -7
- package/src/scripts/brewi.js +505 -9
- package/src/scripts/brewr.js +512 -9
- package/src/scripts/brews.js +462 -9
- package/src/scripts/brewu.js +488 -7
- package/src/scripts/c.js +185 -7
- package/src/scripts/ccurl.js +325 -8
- package/src/scripts/certbot-crontab-init.js +488 -8
- package/src/scripts/certbot-init.js +641 -9
- package/src/scripts/ch.js +339 -7
- package/src/scripts/claude-danger.js +253 -8
- package/src/scripts/clean-dev.js +419 -8
- package/src/scripts/clear-dns-cache.js +525 -7
- package/src/scripts/clone.js +417 -7
- package/src/scripts/code-all.js +420 -7
- package/src/scripts/count-files.js +195 -8
- package/src/scripts/count-folders.js +195 -8
- package/src/scripts/count.js +248 -8
- package/src/scripts/d.js +203 -7
- package/src/scripts/datauri.js +373 -8
- package/src/scripts/delete-files.js +363 -7
- package/src/scripts/docker-clean.js +410 -8
- package/src/scripts/dp.js +426 -7
- package/src/scripts/e.js +375 -9
- package/src/scripts/empty-trash.js +497 -7
- package/src/scripts/evm.js +428 -9
- package/src/scripts/fetch-github-repos.js +441 -10
- package/src/scripts/get-channel.js +329 -8
- package/src/scripts/get-course.js +384 -11
- package/src/scripts/get-dependencies.js +290 -9
- package/src/scripts/get-folder.js +783 -10
- package/src/scripts/get-tunes.js +411 -10
- package/src/scripts/get-video.js +352 -9
- package/src/scripts/git-backup.js +561 -9
- package/src/scripts/git-clone.js +477 -9
- package/src/scripts/git-pup.js +303 -7
- package/src/scripts/git-push.js +380 -8
- package/src/scripts/h.js +607 -9
- package/src/scripts/hide-desktop-icons.js +483 -7
- package/src/scripts/hide-hidden-files.js +522 -7
- package/src/scripts/install-dependencies-from.js +440 -9
- package/src/scripts/ips.js +647 -10
- package/src/scripts/iso.js +354 -8
- package/src/scripts/killni.js +561 -7
- package/src/scripts/ll.js +451 -8
- package/src/scripts/local-ip.js +310 -8
- package/src/scripts/m.js +508 -8
- package/src/scripts/map.js +293 -8
- package/src/scripts/mkd.js +287 -7
- package/src/scripts/ncu-update-all.js +441 -8
- package/src/scripts/nginx-init.js +702 -12
- package/src/scripts/npmi.js +366 -7
- package/src/scripts/o.js +495 -8
- package/src/scripts/org-by-date.js +321 -7
- package/src/scripts/p.js +208 -7
- package/src/scripts/packages.js +313 -8
- package/src/scripts/path.js +209 -7
- package/src/scripts/ports.js +582 -8
- package/src/scripts/q.js +290 -8
- package/src/scripts/refresh-files.js +378 -10
- package/src/scripts/remove-smaller-files.js +500 -8
- package/src/scripts/rename-files-with-date.js +517 -9
- package/src/scripts/resize-image.js +523 -9
- package/src/scripts/rm-safe.js +653 -8
- package/src/scripts/s.js +525 -9
- package/src/scripts/set-git-public.js +349 -7
- package/src/scripts/show-desktop-icons.js +459 -7
- package/src/scripts/show-hidden-files.js +456 -7
- package/src/scripts/tpa.js +265 -8
- package/src/scripts/tpo.js +264 -7
- package/src/scripts/u.js +489 -7
- package/src/scripts/vpush.js +422 -8
- package/src/scripts/y.js +267 -7
- package/src/utils/common/os.js +94 -2
- package/src/utils/ubuntu/apt.js +13 -7
- package/src/utils/windows/choco.js +82 -26
- package/src/utils/windows/winget.js +89 -27
package/src/installs/tmux.js
CHANGED
|
@@ -1,44 +1,346 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @fileoverview Install tmux.
|
|
4
|
+
* @fileoverview Install tmux - a terminal multiplexer for Unix-like systems.
|
|
5
|
+
*
|
|
6
|
+
* tmux is a terminal multiplexer that allows you to create, access, and control
|
|
7
|
+
* multiple terminal sessions from a single screen. Originally developed by
|
|
8
|
+
* Nicholas Marriott and first released in 2007, tmux has become an essential tool
|
|
9
|
+
* for developers, system administrators, and power users who work extensively in
|
|
10
|
+
* the command line.
|
|
11
|
+
*
|
|
12
|
+
* tmux enables you to:
|
|
13
|
+
* - Run multiple terminal sessions within a single window
|
|
14
|
+
* - Detach from sessions and reattach later (even from a different computer)
|
|
15
|
+
* - Split your terminal into multiple panes for side-by-side work
|
|
16
|
+
* - Keep processes running after disconnecting from SSH
|
|
17
|
+
* - Share terminal sessions with other users
|
|
18
|
+
* - Create persistent workspaces that survive terminal crashes
|
|
19
|
+
*
|
|
5
20
|
* @module installs/tmux
|
|
6
21
|
*/
|
|
7
22
|
|
|
8
23
|
const os = require('../utils/common/os');
|
|
24
|
+
const shell = require('../utils/common/shell');
|
|
25
|
+
const brew = require('../utils/macos/brew');
|
|
26
|
+
const apt = require('../utils/ubuntu/apt');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Install tmux on macOS using Homebrew.
|
|
30
|
+
*
|
|
31
|
+
* This function installs tmux via Homebrew, which is the recommended method for
|
|
32
|
+
* macOS. Homebrew automatically installs the required dependencies (libevent,
|
|
33
|
+
* ncurses, and utf8proc) as part of the installation process.
|
|
34
|
+
*
|
|
35
|
+
* @returns {Promise<void>}
|
|
36
|
+
*/
|
|
37
|
+
async function install_macos() {
|
|
38
|
+
// Check if Homebrew is available - it is required for macOS installation
|
|
39
|
+
if (!brew.isInstalled()) {
|
|
40
|
+
console.log('Homebrew is not installed. Please install Homebrew first.');
|
|
41
|
+
console.log('Run: dev install homebrew');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Check if tmux is already installed by verifying the command exists
|
|
46
|
+
// This provides idempotency - running the script multiple times is safe
|
|
47
|
+
const isInstalled = shell.commandExists('tmux');
|
|
48
|
+
if (isInstalled) {
|
|
49
|
+
console.log('tmux is already installed, skipping...');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Install tmux using Homebrew
|
|
54
|
+
// The brew.install function handles the --quiet flag internally for cleaner output
|
|
55
|
+
// Dependencies (libevent, ncurses, utf8proc) are installed automatically
|
|
56
|
+
console.log('Installing tmux via Homebrew...');
|
|
57
|
+
const result = await brew.install('tmux');
|
|
58
|
+
|
|
59
|
+
if (!result.success) {
|
|
60
|
+
console.log('Failed to install tmux via Homebrew.');
|
|
61
|
+
console.log(result.output);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Verify the installation succeeded by checking if the command now exists
|
|
66
|
+
// This catches edge cases where the install reports success but the binary is not available
|
|
67
|
+
const verified = shell.commandExists('tmux');
|
|
68
|
+
if (!verified) {
|
|
69
|
+
console.log('Installation may have failed: tmux command not found after install.');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.log('tmux installed successfully.');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Install tmux on Ubuntu/Debian using APT.
|
|
78
|
+
*
|
|
79
|
+
* tmux is available in the default Ubuntu and Debian repositories, so no
|
|
80
|
+
* additional PPAs or repositories are required. The repository version may
|
|
81
|
+
* be slightly older than the latest release, but is stable and recommended
|
|
82
|
+
* for most users.
|
|
83
|
+
*
|
|
84
|
+
* @returns {Promise<void>}
|
|
85
|
+
*/
|
|
86
|
+
async function install_ubuntu() {
|
|
87
|
+
// Check if tmux is already installed by looking for the command
|
|
88
|
+
// This ensures idempotency - the script can be run multiple times safely
|
|
89
|
+
const isInstalled = shell.commandExists('tmux');
|
|
90
|
+
if (isInstalled) {
|
|
91
|
+
console.log('tmux is already installed, skipping...');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Update package lists before installing to ensure we get the latest available version
|
|
96
|
+
// This is especially important if the package cache is stale
|
|
97
|
+
console.log('Updating package lists...');
|
|
98
|
+
const updateResult = await apt.update();
|
|
99
|
+
if (!updateResult.success) {
|
|
100
|
+
// Continue with installation even if update fails - the package may still be available
|
|
101
|
+
console.log('Warning: Failed to update package lists. Continuing with installation...');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Install tmux using APT
|
|
105
|
+
// The apt.install function uses DEBIAN_FRONTEND=noninteractive and -y flag
|
|
106
|
+
// to ensure fully automated installation without prompts
|
|
107
|
+
console.log('Installing tmux via APT...');
|
|
108
|
+
const result = await apt.install('tmux');
|
|
109
|
+
|
|
110
|
+
if (!result.success) {
|
|
111
|
+
console.log('Failed to install tmux via APT.');
|
|
112
|
+
console.log(result.output);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Verify the installation succeeded by checking if the command exists
|
|
117
|
+
// This confirms the package was installed correctly and is accessible
|
|
118
|
+
const verified = shell.commandExists('tmux');
|
|
119
|
+
if (!verified) {
|
|
120
|
+
console.log('Installation may have failed: tmux command not found after install.');
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
console.log('tmux installed successfully.');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Install tmux on Ubuntu running in WSL (Windows Subsystem for Linux).
|
|
129
|
+
*
|
|
130
|
+
* WSL Ubuntu installations follow the same process as native Ubuntu using APT.
|
|
131
|
+
* This function delegates to install_ubuntu() because WSL provides a full
|
|
132
|
+
* Ubuntu environment with APT package management. tmux works seamlessly in WSL
|
|
133
|
+
* and provides the same functionality as on native Linux.
|
|
134
|
+
*
|
|
135
|
+
* @returns {Promise<void>}
|
|
136
|
+
*/
|
|
137
|
+
async function install_ubuntu_wsl() {
|
|
138
|
+
// WSL Ubuntu uses the same APT-based installation as native Ubuntu
|
|
139
|
+
// The installation process is identical because WSL provides a full Linux environment
|
|
140
|
+
await install_ubuntu();
|
|
141
|
+
}
|
|
9
142
|
|
|
10
143
|
/**
|
|
11
|
-
* Install tmux
|
|
144
|
+
* Install tmux on Raspberry Pi OS using APT.
|
|
145
|
+
*
|
|
146
|
+
* Raspberry Pi OS is based on Debian, so tmux installation follows the same
|
|
147
|
+
* process as Ubuntu/Debian. The tmux package is available for both 32-bit (armv7l)
|
|
148
|
+
* and 64-bit (aarch64) ARM architectures. The repository version may be slightly
|
|
149
|
+
* older than on Ubuntu or Homebrew, but is fully functional.
|
|
150
|
+
*
|
|
151
|
+
* @returns {Promise<void>}
|
|
152
|
+
*/
|
|
153
|
+
async function install_raspbian() {
|
|
154
|
+
// Raspberry Pi OS uses the same APT-based installation as Ubuntu/Debian
|
|
155
|
+
// The tmux package works on both 32-bit and 64-bit ARM architectures
|
|
156
|
+
await install_ubuntu();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Install tmux on Amazon Linux using DNF or YUM.
|
|
161
|
+
*
|
|
162
|
+
* tmux is available in the default Amazon Linux repositories. This function
|
|
163
|
+
* automatically detects whether to use dnf (Amazon Linux 2023) or yum
|
|
164
|
+
* (Amazon Linux 2) based on the available package manager on the system.
|
|
165
|
+
*
|
|
166
|
+
* Note: Amazon Linux 2 reaches end of support on June 30, 2026. Users should
|
|
167
|
+
* consider migrating to Amazon Linux 2023 for long-term support.
|
|
168
|
+
*
|
|
169
|
+
* @returns {Promise<void>}
|
|
170
|
+
*/
|
|
171
|
+
async function install_amazon_linux() {
|
|
172
|
+
// Check if tmux is already installed by looking for the command
|
|
173
|
+
// This ensures the script is idempotent and safe to run multiple times
|
|
174
|
+
const isInstalled = shell.commandExists('tmux');
|
|
175
|
+
if (isInstalled) {
|
|
176
|
+
console.log('tmux is already installed, skipping...');
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Detect the platform to determine which package manager to use
|
|
181
|
+
// Amazon Linux 2023 uses dnf, while Amazon Linux 2 uses yum
|
|
182
|
+
const platform = os.detect();
|
|
183
|
+
const packageManager = platform.packageManager;
|
|
184
|
+
|
|
185
|
+
// Construct the install command based on available package manager
|
|
186
|
+
// The -y flag automatically confirms installation prompts for non-interactive execution
|
|
187
|
+
const installCommand = packageManager === 'dnf'
|
|
188
|
+
? 'sudo dnf install -y tmux'
|
|
189
|
+
: 'sudo yum install -y tmux';
|
|
190
|
+
|
|
191
|
+
// Install tmux using the detected package manager
|
|
192
|
+
console.log(`Installing tmux via ${packageManager}...`);
|
|
193
|
+
const result = await shell.exec(installCommand);
|
|
194
|
+
|
|
195
|
+
if (result.code !== 0) {
|
|
196
|
+
console.log(`Failed to install tmux via ${packageManager}.`);
|
|
197
|
+
console.log(result.stderr || result.stdout);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Verify the installation succeeded by checking if the command exists
|
|
202
|
+
const verified = shell.commandExists('tmux');
|
|
203
|
+
if (!verified) {
|
|
204
|
+
console.log('Installation may have failed: tmux command not found after install.');
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
console.log('tmux installed successfully.');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Display informational message for Windows users.
|
|
213
|
+
*
|
|
214
|
+
* tmux is a Unix-native application and does not run natively on Windows.
|
|
215
|
+
* This function provides a graceful message informing Windows users that
|
|
216
|
+
* tmux is not available on their platform. Users running WSL will be
|
|
217
|
+
* handled by the install_ubuntu_wsl() function instead.
|
|
218
|
+
*
|
|
219
|
+
* Note: While tmux can technically run in Cygwin or MSYS2, these approaches
|
|
220
|
+
* are not recommended for production use. WSL provides better integration
|
|
221
|
+
* and performance for running tmux on Windows.
|
|
222
|
+
*
|
|
223
|
+
* @returns {Promise<void>}
|
|
224
|
+
*/
|
|
225
|
+
async function install_windows() {
|
|
226
|
+
// tmux is a Unix-native application that relies on Unix-specific features
|
|
227
|
+
// like pseudo-terminals (ptys) and does not run natively on Windows
|
|
228
|
+
// Return gracefully without throwing an error
|
|
229
|
+
console.log('tmux is not available for Windows.');
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Display informational message for Git Bash users.
|
|
235
|
+
*
|
|
236
|
+
* While tmux can technically be installed in Git Bash through MSYS2 by copying
|
|
237
|
+
* binaries and DLLs, this approach requires additional manual setup and only
|
|
238
|
+
* works with the MinTTY terminal. This function provides a graceful message
|
|
239
|
+
* rather than attempting a complex installation that may not work reliably.
|
|
240
|
+
*
|
|
241
|
+
* For users who need tmux on Windows, WSL (Windows Subsystem for Linux)
|
|
242
|
+
* provides a better experience with full Linux environment support.
|
|
243
|
+
*
|
|
244
|
+
* @returns {Promise<void>}
|
|
245
|
+
*/
|
|
246
|
+
async function install_gitbash() {
|
|
247
|
+
// tmux in Git Bash requires copying binaries from a full MSYS2 installation
|
|
248
|
+
// This is complex and only works with MinTTY terminal (git-bash.exe)
|
|
249
|
+
// Return gracefully without throwing an error
|
|
250
|
+
console.log('tmux is not available for Git Bash.');
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Check if tmux is installed on the current system.
|
|
256
|
+
* @returns {Promise<boolean>} True if tmux is installed
|
|
257
|
+
*/
|
|
258
|
+
async function isInstalled() {
|
|
259
|
+
const platform = os.detect();
|
|
260
|
+
if (platform.type === 'macos') {
|
|
261
|
+
return brew.isFormulaInstalled('tmux');
|
|
262
|
+
}
|
|
263
|
+
return shell.commandExists('tmux');
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Check if this installer is supported on the current platform.
|
|
268
|
+
* tmux is only available on Unix-like systems (not Windows/Git Bash).
|
|
269
|
+
* @returns {boolean} True if installation is supported on this platform
|
|
270
|
+
*/
|
|
271
|
+
function isEligible() {
|
|
272
|
+
const platform = os.detect();
|
|
273
|
+
return ['macos', 'ubuntu', 'debian', 'wsl', 'raspbian', 'amazon_linux', 'fedora', 'rhel'].includes(platform.type);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Main installation entry point - detects platform and runs appropriate installer.
|
|
278
|
+
*
|
|
279
|
+
* This function detects the current operating system and dispatches to the
|
|
280
|
+
* appropriate platform-specific installer function. The function handles
|
|
281
|
+
* unsupported platforms gracefully by displaying a message without throwing errors.
|
|
282
|
+
*
|
|
283
|
+
* Supported platforms:
|
|
284
|
+
* - macOS (Homebrew)
|
|
285
|
+
* - Ubuntu/Debian (APT)
|
|
286
|
+
* - Ubuntu on WSL (APT)
|
|
287
|
+
* - Raspberry Pi OS (APT)
|
|
288
|
+
* - Amazon Linux/RHEL (DNF/YUM)
|
|
289
|
+
*
|
|
290
|
+
* Unsupported platforms (graceful message):
|
|
291
|
+
* - Windows (native)
|
|
292
|
+
* - Git Bash
|
|
12
293
|
*
|
|
13
294
|
* @returns {Promise<void>}
|
|
14
295
|
*/
|
|
15
296
|
async function install() {
|
|
16
297
|
const platform = os.detect();
|
|
17
298
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
299
|
+
// Map platform types to their corresponding installer functions
|
|
300
|
+
// Multiple platform types can map to the same installer (e.g., debian and ubuntu)
|
|
301
|
+
const installers = {
|
|
302
|
+
'macos': install_macos,
|
|
303
|
+
'ubuntu': install_ubuntu,
|
|
304
|
+
'debian': install_ubuntu,
|
|
305
|
+
'wsl': install_ubuntu_wsl,
|
|
306
|
+
'raspbian': install_raspbian,
|
|
307
|
+
'amazon_linux': install_amazon_linux,
|
|
308
|
+
'fedora': install_amazon_linux,
|
|
309
|
+
'rhel': install_amazon_linux,
|
|
310
|
+
'windows': install_windows,
|
|
311
|
+
'gitbash': install_gitbash,
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// Look up the installer for the detected platform
|
|
315
|
+
const installer = installers[platform.type];
|
|
316
|
+
|
|
317
|
+
// If no installer exists for this platform, inform the user gracefully
|
|
318
|
+
// Do not throw an error - just log a message and return
|
|
319
|
+
if (!installer) {
|
|
320
|
+
console.log(`tmux is not available for ${platform.type}.`);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Run the platform-specific installer
|
|
325
|
+
await installer();
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
module.exports = {
|
|
329
|
+
install,
|
|
330
|
+
isInstalled,
|
|
331
|
+
isEligible,
|
|
332
|
+
install_macos,
|
|
333
|
+
install_ubuntu,
|
|
334
|
+
install_ubuntu_wsl,
|
|
335
|
+
install_raspbian,
|
|
336
|
+
install_amazon_linux,
|
|
337
|
+
install_windows,
|
|
338
|
+
install_gitbash,
|
|
339
|
+
};
|
|
41
340
|
|
|
42
341
|
if (require.main === module) {
|
|
43
|
-
install()
|
|
342
|
+
install().catch(err => {
|
|
343
|
+
console.error(err.message);
|
|
344
|
+
process.exit(1);
|
|
345
|
+
});
|
|
44
346
|
}
|