Last active
          September 5, 2023 20:48 
        
      - 
      
- 
        Save danny-andrews/3b7cf181bbc0c33c3b410f4ebdf7e623 to your computer and use it in GitHub Desktop. 
Revisions
- 
        danny-andrews revised this gist Sep 5, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -67,7 +67,7 @@ Quotes are only required for strings that contain special characters (e.g. space ✅ `git commit -m "Fix thing"` ✅ `git commit -m Fix` > **Note**: When writing npm scripts, prefer double quotes (`"`) to single (`'`) for better cross-compatability with Windows. --- 
- 
        danny-andrews revised this gist Sep 5, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -73,7 +73,7 @@ Quotes are only required for strings that contain special characters (e.g. space ### Subcommands Many modern command-line programs use a command-subcommand structure. In the following example, `git` is the root command, and `commit` is the subcommand. `git commit -m "Hi"` 
- 
        danny-andrews revised this gist Sep 5, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,9 +63,9 @@ I prefer to put positional arguments before options/flags when possible, as I fi Quotes are only required for strings that contain special characters (e.g. spaces). ❌ `git commit -m Fix thing` ✅ `git commit -m "Fix thing"` ✅ `git commit -m Fix` > **Note**: When writing npm scripts, prefer double quotes `"` to single `'` for better cross-compatability with Windows. 
- 
        danny-andrews revised this gist Sep 5, 2023 . 1 changed file with 11 additions and 11 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,17 +16,17 @@ Options are named arguments and come in two forms: `git commit -m "Fix"` - **Long**: Multi-letter options are preceeded by a `--` with values placed after (separated by a `=` or by a space). `git commit --message="Fix"` 🟰 `git commit --message "Fix"` > **Note:** Spaces aren't *required* after options, but are *encouranged* for readability, because `git commit -m"Fix"` looks cramped. --- ### Flags Flags represent boolean values. They are options which don't take a value and can be long or short. `git commit --dry-run -v` @@ -36,24 +36,24 @@ Flags don't take a value and can be long or short. When using multiple short flags, you can combine them into one. `ls -a -g -h` 🟰 `ls -agh` 🟰 `ls -gha` --- ### Ordering The order of options/flags does not matter. `ls -a -g` 🟰 `ls -g -a` **However**, some commands require all options/flags to come before positional arguments. ❌ `ls my-dir -a` ✅ `ls -a my-dir` Thankfully, most modern commands are agnostic. `git add a.js -v` 🟰 `git add -v a.js` I prefer to put positional arguments before options/flags when possible, as I find it easier to read. @@ -63,9 +63,9 @@ I prefer to put positional arguments before options/flags when possible, as I fi Quotes are only required for strings that contain special characters (e.g. spaces). ❌: `git commit -m Fix thing` ✅: `git commit -m "Fix thing"` ✅: `git commit -m Fix` > **Note**: When writing npm scripts, prefer double quotes `"` to single `'` for better cross-compatability with Windows. 
- 
        danny-andrews revised this gist Sep 5, 2023 . 1 changed file with 8 additions and 5 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,26 @@ # Shell Command Structure Summary ### Arguments (i.e. Positional Arguments) Positional arguments are passed as-is after the command name. Order matters. `cat file1.txt file2.txt` --- ### Options (Named Arguments) Options are named arguments and come in two forms: - **Short**: One-letter options are preceeded by a `-` with values placed after (separated by a space). `git commit -m "Fix"` - **Long**: Multi-letter options are preceeded by a `--` with values placed after (separated by a `=` or a space). `git commit --message="Fix"` = `git commit --message "Fix"` > **Note:** Spaces aren't *required* after options, but are *encouranged* for readability, because `git commit -m"Fix"` looks cramped. --- 
- 
        danny-andrews revised this gist Sep 5, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Shell Command Structure Summary ### Arguments (Positional Arguments) Positional arguments are passed as-is after the command name. 
- 
        danny-andrews revised this gist Sep 5, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,7 +52,7 @@ Thankfully, most modern commands are agnostic. `git add a.js -v` = `git add -v a.js` I prefer to put positional arguments before options/flags when possible, as I find it easier to read. --- 
- 
        danny-andrews revised this gist Mar 31, 2023 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,6 +68,12 @@ Quotes are only required for strings that contain special characters (e.g. space --- ### Subcommands Many modern commands use a command-subcommand structure, like git. In the following example, `git` is the root command, and `commit` is the subcommand. `git commit -m "Hi"` ### Summary  
- 
        danny-andrews revised this gist Mar 31, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,7 +45,7 @@ The order of options/flags does not matter. **However**, some commands require all options/flags to come before positional arguments. **FAILS**: `ls my-dir -a` **WORKS**: `ls -a my-dir` Thankfully, most modern commands are agnostic. 
- 
        danny-andrews created this gist Mar 31, 2023 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ # Shell Command Structure Summary ### Positional Arguments Positional arguments are passed as-is after the command name. `cat file1.txt file2.txt` --- ### Options (Named Arguments) Options take values and come in two types: - **Short**: One-letter options preceeded by a `-`. Values are placed after (usually separated by a space). `git commit -m "Fix"` - **Long**: Multi-letter options preceeded by a `--`. Values are placed after (separated by `=` or a space). `git commit --message="Fix"` = `git commit --message "Fix"` --- ### Flags Flags don't take a value and can be long or short. `git commit --dry-run -v` --- ### Combining Short Flags When using multiple short flags, you can combine them into one. `ls -a -g -h` = `ls -agh` --- ### Ordering The order of options/flags does not matter. `ls -a -g` = `ls -g -a` **However**, some commands require all options/flags to come before positional arguments. **FAILS**: `ls my-dir -a` **WORKS**: `ls -a my-dir` Thankfully, most modern commands are agnostic. `git add a.js -v` = `git add -v a.js` I prefer to put positional arguments before options/flags when possible, as I find it easier easier to read. --- ### Quotes Quotes are only required for strings that contain special characters (e.g. spaces). **FAILS**: `git commit -m Fix thing` **WORKS**: `git commit -m "Fix thing"` **WORKS**: `git commit -m Fix` > **Note**: When writing npm scripts, prefer double quotes `"` to single `'` for better cross-compatability with Windows. --- ### Summary 