@shreyash1601/oopsify 1.0.5 → 1.1.1
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 +91 -53
- package/bin/index.js +25 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,40 +1,49 @@
|
|
|
1
|
-
# 🔊 Oopsify
|
|
1
|
+
# 🔊 Oopsify CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://github.com/Shreyash1601/oopsify/blob/master/oopsify.jpeg" alt="Oopsify Logo" width="320"/>
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>Let your failures make the noise!!</b>
|
|
9
|
+
</p>
|
|
6
10
|
|
|
7
11
|
---
|
|
8
12
|
|
|
9
13
|
## 🚀 Features
|
|
10
14
|
|
|
11
|
-
* 🔊 Play
|
|
15
|
+
* 🔊 Play meme sounds on terminal errors automatically
|
|
12
16
|
* 🎧 Choose your favorite meme sound
|
|
13
17
|
* 🎯 Interactive CLI with arrow-key selection
|
|
14
|
-
*
|
|
15
|
-
*
|
|
18
|
+
* 🎨 Styled error message with emoji
|
|
19
|
+
* ⚡ Lightweight and fun developer utility
|
|
16
20
|
|
|
17
21
|
---
|
|
18
22
|
|
|
19
23
|
## 📦 Installation
|
|
20
24
|
|
|
21
25
|
```bash
|
|
22
|
-
npm install -g @shreyash1601/oopsify
|
|
26
|
+
npm install -g @shreyash1601/oopsify-cli
|
|
23
27
|
```
|
|
24
28
|
|
|
25
29
|
---
|
|
26
30
|
|
|
27
31
|
## ⚙️ Setup (Required)
|
|
28
32
|
|
|
29
|
-
Run:
|
|
30
|
-
|
|
31
33
|
```bash
|
|
32
34
|
oopsify setup
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
👉 Restart your terminal after setup.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 💥 Automatic Mode
|
|
42
|
+
|
|
43
|
+
After setup, any failed command will trigger:
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
* 🔊 Meme sound
|
|
46
|
+
* 😵 Styled error message
|
|
38
47
|
|
|
39
48
|
---
|
|
40
49
|
|
|
@@ -46,18 +55,12 @@ Then restart your terminal.
|
|
|
46
55
|
oopsify list
|
|
47
56
|
```
|
|
48
57
|
|
|
49
|
-
---
|
|
50
|
-
|
|
51
58
|
### Set default sound
|
|
52
59
|
|
|
53
60
|
```bash
|
|
54
61
|
oopsify set
|
|
55
62
|
```
|
|
56
63
|
|
|
57
|
-
Use arrow keys ⬆️⬇️ and press Enter.
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
64
|
### Play sound manually
|
|
62
65
|
|
|
63
66
|
```bash
|
|
@@ -66,77 +69,118 @@ oopsify
|
|
|
66
69
|
|
|
67
70
|
---
|
|
68
71
|
|
|
69
|
-
##
|
|
72
|
+
## ⚠️ Compatibility
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
Currently supported environment:
|
|
72
75
|
|
|
73
|
-
*
|
|
74
|
-
*
|
|
76
|
+
* ✅ **Windows Terminal / VS Code Terminal**
|
|
77
|
+
* ✅ **PowerShell (required)**
|
|
75
78
|
|
|
76
79
|
---
|
|
77
80
|
|
|
78
|
-
###
|
|
81
|
+
### ❌ Not supported (yet)
|
|
82
|
+
|
|
83
|
+
* macOS Terminal
|
|
84
|
+
* Linux shells
|
|
85
|
+
* CMD (Command Prompt)
|
|
86
|
+
* Git Bash
|
|
87
|
+
|
|
88
|
+
👉 Support for macOS and Linux is planned in upcoming versions 🚀
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🛠️ Troubleshooting
|
|
93
|
+
|
|
94
|
+
### 🔸 Sound not playing
|
|
95
|
+
|
|
96
|
+
* Ensure system audio is working
|
|
97
|
+
* Try opening `.wav` file manually
|
|
98
|
+
* Ensure `.wav` format:
|
|
99
|
+
|
|
100
|
+
* PCM encoding
|
|
101
|
+
* 16-bit
|
|
102
|
+
* 44.1 kHz
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
### 🔸 `oopsify` command not working
|
|
79
107
|
|
|
80
108
|
```bash
|
|
81
|
-
|
|
109
|
+
npm install -g @shreyash1601/oopsify-cli
|
|
82
110
|
```
|
|
83
111
|
|
|
84
|
-
|
|
112
|
+
* Ensure npm global path is added to system PATH
|
|
85
113
|
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### 🔸 Error detection not triggering
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
oopsify setup
|
|
86
120
|
```
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
```
|
|
121
|
+
|
|
122
|
+
* Restart terminal
|
|
123
|
+
* Ensure using **PowerShell** (not CMD)
|
|
91
124
|
|
|
92
125
|
---
|
|
93
126
|
|
|
94
|
-
|
|
127
|
+
### 🔸 PowerShell not detected
|
|
128
|
+
|
|
129
|
+
Install PowerShell:
|
|
95
130
|
|
|
96
|
-
|
|
131
|
+
👉 https://aka.ms/powershell-release?tag=stable
|
|
97
132
|
|
|
98
|
-
|
|
99
|
-
* bash/zsh → `.bashrc` / `.zshrc`
|
|
133
|
+
Verify:
|
|
100
134
|
|
|
101
|
-
|
|
135
|
+
```bash
|
|
136
|
+
pwsh
|
|
137
|
+
```
|
|
102
138
|
|
|
103
139
|
---
|
|
104
140
|
|
|
105
|
-
|
|
141
|
+
### 🔸 Setup not applied
|
|
142
|
+
|
|
143
|
+
```powershell
|
|
144
|
+
echo $PROFILE
|
|
145
|
+
```
|
|
106
146
|
|
|
107
|
-
|
|
108
|
-
* Restart your terminal after setup
|
|
109
|
-
* Works best in modern terminals (VS Code, Windows Terminal, etc.)
|
|
147
|
+
Ensure it contains the `oopsify setup` block.
|
|
110
148
|
|
|
111
149
|
---
|
|
112
150
|
|
|
113
|
-
##
|
|
151
|
+
## 🧠 How it works
|
|
152
|
+
|
|
153
|
+
Oopsify hooks into the PowerShell prompt and detects failed commands using:
|
|
114
154
|
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
|
|
155
|
+
* `$?`
|
|
156
|
+
* `$LASTEXITCODE`
|
|
157
|
+
* `$Error`
|
|
158
|
+
|
|
159
|
+
When an error is detected → sound is triggered.
|
|
119
160
|
|
|
120
161
|
---
|
|
121
162
|
|
|
122
163
|
## 📁 Project Structure
|
|
123
164
|
|
|
124
165
|
```
|
|
125
|
-
oopsify/
|
|
166
|
+
oopsify-cli/
|
|
126
167
|
bin/
|
|
127
168
|
index.js
|
|
128
169
|
sounds/
|
|
129
170
|
*.wav
|
|
171
|
+
assets/
|
|
172
|
+
logo.png
|
|
130
173
|
```
|
|
131
174
|
|
|
132
175
|
---
|
|
133
176
|
|
|
134
177
|
## 🚀 Roadmap
|
|
135
178
|
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
179
|
+
* macOS support
|
|
180
|
+
* Linux support
|
|
181
|
+
* Random sound mode
|
|
182
|
+
* Volume control
|
|
183
|
+
* Custom sound upload
|
|
140
184
|
|
|
141
185
|
---
|
|
142
186
|
|
|
@@ -146,12 +190,6 @@ oopsify/
|
|
|
146
190
|
|
|
147
191
|
---
|
|
148
192
|
|
|
149
|
-
## ⭐ Support
|
|
150
|
-
|
|
151
|
-
If you like this project, consider giving it a star ⭐ on GitHub (if you host it).
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
193
|
## 📄 License
|
|
156
194
|
|
|
157
195
|
MIT License
|
package/bin/index.js
CHANGED
|
@@ -6,6 +6,23 @@ const sound = require('sound-play');
|
|
|
6
6
|
const os = require('os');
|
|
7
7
|
const isWindows = process.platform === 'win32';
|
|
8
8
|
|
|
9
|
+
|
|
10
|
+
const { execSync } = require('child_process');
|
|
11
|
+
|
|
12
|
+
function getPowerShellCommand() {
|
|
13
|
+
try {
|
|
14
|
+
execSync('powershell -Command "echo test"', { stdio: 'ignore' });
|
|
15
|
+
return 'powershell';
|
|
16
|
+
} catch {
|
|
17
|
+
try {
|
|
18
|
+
execSync('pwsh -Command "echo test"', { stdio: 'ignore' });
|
|
19
|
+
return 'pwsh';
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
9
26
|
(async () => {
|
|
10
27
|
// 👉 ESM imports
|
|
11
28
|
const chalkImport = await import('chalk');
|
|
@@ -22,10 +39,16 @@ if (command === 'setup') {
|
|
|
22
39
|
const { execSync } = require('child_process');
|
|
23
40
|
|
|
24
41
|
if (isWindows) {
|
|
42
|
+
const shell = getPowerShellCommand();
|
|
43
|
+
|
|
44
|
+
if (!shell) {
|
|
45
|
+
console.error('❌ PowerShell not found on this system');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
25
49
|
try {
|
|
26
|
-
// 👉 Get actual PowerShell profile path
|
|
27
50
|
const profilePath = execSync(
|
|
28
|
-
|
|
51
|
+
`${shell} -NoProfile -Command "$PROFILE"`,
|
|
29
52
|
{ encoding: 'utf-8' }
|
|
30
53
|
).trim();
|
|
31
54
|
|