Skip to content

Commit a8fe80a

Browse files
author
alexanderwoehler
committed
feat(snippets): add "getopts" snippet
1 parent bc07391 commit a8fe80a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

server/src/snippets.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,22 @@ export const SNIPPETS: BashCompletionItem[] = [
288288
'done',
289289
].join('\n'),
290290
},
291+
{
292+
label: 'while-getopts',
293+
documentation: 'while with getopts argument-parsing',
294+
insertText: [
295+
'while getopts "${1:patterns}" ${2:expression}; do',
296+
'\tcase "\\${$2}" in',
297+
'\t\t${3:pattern})',
298+
'\t\t\t${4:command ...}',
299+
'\t\t\t;;',
300+
'\t\t*)',
301+
'\t\t\t${5:command ...}',
302+
'\t\t\t;;',
303+
'\tesac',
304+
'done',
305+
].join('\n'),
306+
},
291307
{
292308
label: 'until',
293309
documentation: 'until operator',

0 commit comments

Comments
 (0)