From 85b8fa5f997b2e305391a15f083ed6bf1edaed7f Mon Sep 17 00:00:00 2001 From: Miau Lightouch <5199594+miaulightouch@users.noreply.github.com> Date: Sun, 12 Aug 2018 01:58:22 +0800 Subject: [PATCH] Improve usability of Windows notes w/ examples for prompts & npm script (visionmedia/debug#577) --- README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1eac7ed..6f687bd 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,9 @@ Here are some examples: screen shot 2017-08-08 at 12 53 38 pm screen shot 2017-08-08 at 12 53 25 pm -### Windows note +### Windows command prompt notes + +#### CMD On Windows the environment variable is set using the `set` command. @@ -84,14 +86,34 @@ On Windows the environment variable is set using the `set` command. set DEBUG=*,-not_this ``` -Note that PowerShell uses different syntax to set environment variables. +Example: + +```cmd +set DEBUG=* & node app.js +``` + +#### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. ```cmd $env:DEBUG = "*,-not_this" ``` +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + Then, run the program to be debugged as usual. +npm script example: + +```javascript + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + ## Namespace Colors Every debug instance has a color generated for it based on its namespace name.