Comparing version 0.32.0 to 0.33.0
@@ -53,3 +53,3 @@ /// <reference types="node" /> | ||
declare const _echo: { | ||
(content: string, ...optionalArgs: any[]): void; | ||
(content: string | Error, ...optionalArgs: any[]): void; | ||
/** | ||
@@ -60,3 +60,3 @@ * Prints yellow colored content to stdout with a trailing newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values | ||
*/ | ||
yellow(content: string, ...optionalArgs: any[]): void; | ||
yellow(content: string | Error, ...optionalArgs: any[]): void; | ||
/** | ||
@@ -67,3 +67,3 @@ * Prints green colored content to stdout with a trailing newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values | ||
*/ | ||
green(content: string, ...optionalArgs: any[]): void; | ||
green(content: string | Error, ...optionalArgs: any[]): void; | ||
/** | ||
@@ -74,3 +74,3 @@ * Prints red colored content to stdout with a trailing newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values | ||
*/ | ||
red(content: string, ...optionalArgs: any[]): void; | ||
red(content: string | Error, ...optionalArgs: any[]): void; | ||
}; | ||
@@ -77,0 +77,0 @@ /** |
{ | ||
"name": "jsh", | ||
"version": "0.32.0", | ||
"version": "0.33.0", | ||
"description": "Helpers for Bash like shell scripting in JavaScript", | ||
@@ -5,0 +5,0 @@ "author": "Brady Holt", |
@@ -60,4 +60,3 @@ # jsh | ||
| `$0` | Return the name of the current script file (ex: `my_script.js`) | | ||
| `$HOME` | Access an environment variable | | ||
| `env.HOME` or `env["HOME"]` | Access an environment variable from the `env` object | | ||
| `$HOME`,`env.HOME`, or `env["HOME"]`| Access an environment variable | | ||
| `const USER = env.assert("USER")` or `const [HOME, USER] = env.assert(["HOME", "USER"])` | Return environment variable value or call `usage.printAndExit()` if undefined. You can also pass an array of environment variable names and an array of values will be returned. | | ||
@@ -69,3 +68,3 @@ | ||
| `result=$("cmd.sh")` | Execute a command and return the stdout | | ||
| `exec("cmd.sh")` | Execute a command and streams stdout to console without returning a value | | ||
| `exec("cmd.sh")` | Execute a command and stream stdout to console without returning a value | | ||
@@ -84,2 +83,4 @@ **File System** | ||
| `dirname("./path/file.txt")` | Return the directory name for a path | | ||
| `__dirname` | Returns the absolute path (directory) containing the entry script | | ||
| `__filename` | Returns the name of the entry script | | ||
@@ -172,3 +173,3 @@ **HTTP Requests** | ||
There are a few ways that usage.printAndExit() will be called implicitly: | ||
1. If `--help` or `-h` is passed in as an argument | ||
1. If `--help` or `-h` is passed in as an argument. (Note: in this case, the exit code will be set to 0) | ||
1. If `args.assertCount()` is called and the required number of arguments were not passed in. For example, if args.assertCount(3) is called and only 2 arguments were passed in. | ||
@@ -175,0 +176,0 @@ 1. If `env.assert()` is called and the environment variable(s) are not defined. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70260
465