Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,18 @@ Additionally it added the following new snippets:
- main : main
- const : const
- todo : TODO

### [1.0.1]

`forrange` snippet:
Removed the line using the index to reference the index of an array as it is not strictly part of the snippet, `arri` was introduced for that purpose.

Documented the following snippets, that were previously implemented, some of them under different names (name changes reported below):
- `array` : declares an array
- `forarray` -> `forarre` : iterates throught the elements in an array
- `forindex` -> `forrange` : iterates throught a range of indexes


Added the following new snippet:
- `case`: shell case statement
- `arri`: Array indexing statement
55 changes: 33 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@ A collection of bash snippets

Just a few snippets to make shellscript dev easier

- shebang : shebang
- e : echo
- fn : function
- fnd : function with definitions
- if : if
- ife : if else
- elif : elif
- until : until
- main : main
- const : const
- todo : TODO
- `shebang` : shebang
- `e` : echo
- `fn` : function
- `fnd` : function with definitions
- `if` : if
- `ife` : if else
- `elif` : elif
- `until` : until
- `main` : main
- `const` : const
- `todo` : TODO
- `array` : array declaration
- `forarre` : iterates throught the elements in an array
- `forrange` : iterates throught a range of indexes
- `case`: shell case statement
- `arri`: Array indexing statement

## Known Issues

Expand All @@ -26,13 +31,13 @@ None

### 0.0.1

- shebang : shebang
- e : echo
- fn : function
- if : if
- ife : if else
- elif : elif
- until : until
- `shebang` : shebang
- `e` : echo
- `fn` : function
- `if` : if
- `ife` : if else
- `elif` : elif
- `until` : until

### 0.0.2

Expand All @@ -43,9 +48,15 @@ Added a logo
This release updated the format choice for function names (fn) to align with the [Shell Style Guide](https://google.github.io/styleguide/shellguide.html#function-comments)

Additionally it added the following new snippets:
- fnd : function with definitions
- main : main
- const : const
- todo : TODO
- `fnd` : function with definitions
- `main` : main
- `const` : const
- `todo` : TODO

### 1.0.1

Added the following new snippet:
- `case`: shell case statement
- `arri`: Array indexing statement

**Enjoy!**
45 changes: 39 additions & 6 deletions snippets/snippets.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,56 @@
],
"description": "Creates an array with two elements"
},
"forarray": {
"prefix": "forarray",
"forarre": {
"prefix": "forarre",
"body": [
"for ${0:element} in \\${${MYARRAY}[@]\\}; do",
"echo \\$${0:element}",
"done"
],
"description": "Creates a loop echoing all variables in an array"
"description": "Creates a loop echoing all elements in an array"
},
"forindex": {
"prefix": "forindex",
"forrange": {
"prefix": "forrange",
"body": [
"for ${0:i} in {${1:0}..${2:5}\\}; do",
"echo \\$${0:i}",
"echo \\${MYARRAY[${0:i}]}",
"done"
],
"description": "Creates a loop echoing all indexes in a range"
},
"case": {
"prefix": "case",
"body": [
"case ${1:expression} in",
"${2:patt_1})",
" STATEMENTS",
" ;;",
"${3:patt_2})",
" STATEMENTS",
" ;;",
"*)",
" STATEMENTS",
" ;;",
"esac"
],
"description": "Creates a case statement"
},
"arri": {
"prefix": "arri",
"body": [
"${${1:myArray}[${2:i}]}"
],
"description": "Array indexing statement"
},
"while": {
"prefix": "while",
"body": [
"while [ ${1:condition} ]",
"do",
" ${2:echo hi}",
"done"
],
"description": "Array indexing statement"
}
}