is-cool-cli 0.0.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.
Files changed (3) hide show
  1. package/README.md +81 -0
  2. package/index.js +36 -0
  3. package/package.json +28 -0
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # is-cool-cli 😎
2
+
3
+ A simple CLI tool that checks if a string contains the word "cool".
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g is-cool-cli
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # Basic usage
15
+ iscool "this is cool"
16
+ # Output:
17
+ # Input: "this is cool"
18
+ # Contains "cool": true
19
+
20
+ # Case insensitive
21
+ iscool "COOL STUFF"
22
+ # Output:
23
+ # Input: "COOL STUFF"
24
+ # Contains "cool": true
25
+
26
+ # Multiple words
27
+ iscool this is really cool stuff
28
+ # Output:
29
+ # Input: "this is really cool stuff"
30
+ # Contains "cool": true
31
+
32
+ # No match
33
+ iscool "this is warm"
34
+ # Output:
35
+ # Input: "this is warm"
36
+ # Contains "cool": false
37
+ ```
38
+
39
+ ## Exit Codes
40
+
41
+ - `0`: String contains "cool"
42
+ - `1`: String does not contain "cool" or invalid usage
43
+
44
+ This makes it useful in shell scripts:
45
+
46
+ ```bash
47
+ if iscool "cool beans"; then
48
+ echo "It's cool!"
49
+ else
50
+ echo "Not cool."
51
+ fi
52
+ ```
53
+
54
+ ## API
55
+
56
+ You can also use it as a Node.js module:
57
+
58
+ ```javascript
59
+ const { isCool } = require('is-cool-cli');
60
+
61
+ console.log(isCool('cool stuff')); // true
62
+ console.log(isCool('warm weather')); // false
63
+ console.log(isCool('COOL BEANS')); // true (case insensitive)
64
+ ```
65
+
66
+ ## Examples
67
+
68
+ ```bash
69
+ iscool "ice cold" # false
70
+ iscool "cool as a cucumber" # true
71
+ iscool "school" # true (contains "cool")
72
+ iscool "warm" # false
73
+ ```
74
+
75
+ ## Why?
76
+
77
+ Sometimes you just need to know if something is cool. 🤷‍♂️
78
+
79
+ ## License
80
+
81
+ MIT
package/index.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+
3
+ function isCool(inputString) {
4
+ if (typeof inputString !== 'string') {
5
+ return false;
6
+ }
7
+ return inputString.toLowerCase().includes('cool');
8
+ }
9
+
10
+ function main() {
11
+ // Get command line arguments (skip first 2 which are node and script path)
12
+ const args = process.argv.slice(2);
13
+
14
+ if (args.length === 0) {
15
+ console.log('Usage: iscool "your string here"');
16
+ console.log('Example: iscool "this is cool"');
17
+ process.exit(1);
18
+ }
19
+
20
+ // Join all arguments into a single string
21
+ const inputString = args.join(' ');
22
+ const result = isCool(inputString);
23
+
24
+ console.log(`Input: "${inputString}"`);
25
+ console.log(`Contains "cool": ${result}`);
26
+
27
+ // Exit with different codes based on result (useful for scripts)
28
+ process.exit(result ? 0 : 1);
29
+ }
30
+
31
+ // Only run main if this file is executed directly
32
+ if (require.main === module) {
33
+ main();
34
+ }
35
+
36
+ module.exports = { isCool };
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "is-cool-cli",
3
+ "version": "0.0.1",
4
+ "description": "A simple CLI that checks if a string contains 'cool'",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "iscool": "index.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node index.js 'this is cool'"
11
+ },
12
+ "keywords": [
13
+ "cli",
14
+ "cool",
15
+ "string",
16
+ "check"
17
+ ],
18
+ "author": "Eli Rousso",
19
+ "license": "MIT",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/elirousso/is-cool-cli.git"
23
+ },
24
+ "homepage": "https://github.com/elirousso/is-cool-cli#readme",
25
+ "bugs": {
26
+ "url": "https://github.com/elirousso/is-cool-cli/issues"
27
+ }
28
+ }