X Tutup
Skip to content

Commit d22286a

Browse files
committed
Add examples to template
1 parent 50a15ca commit d22286a

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

pkg/cmd/extension/manager.go

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,40 @@ func (m *Manager) Create(name string) error {
269269

270270
fileTmpl := heredoc.Docf(`
271271
#!/bin/bash
272+
set -e
272273
echo "Hello %[1]s"
273-
`, name)
274+
275+
# Examples to help get started:
276+
277+
# Determine if an executable is in the PATH
278+
# if [ "$(which go)" = "" ]; then
279+
# echo "go not found in PATH"
280+
# exit 1
281+
# fi
282+
283+
# Pass arguments through to a new process
284+
# exec gh issue list "$@" -R cli/cli
285+
286+
# Using the gh api command to retrieve and format information
287+
# QUERY='
288+
# query($endCursor: String) {
289+
# viewer {
290+
# repositories(first: 100, after: $endCursor) {
291+
# nodes {
292+
# nameWithOwner
293+
# stargazerCount
294+
# }
295+
# }
296+
# }
297+
# }
298+
# '
299+
# TEMPLATE='
300+
# {{- range $repo := .data.viewer.repositories.nodes -}}
301+
# {{- printf "name: %[2]s - stargazers: %[3]s\n" $repo.nameWithOwner $repo.stargazerCount -}}
302+
# {{- end -}}
303+
# '
304+
# exec gh api graphql --template="${TEMPLATE}" --paginate -f query="${QUERY}"
305+
`, name, "%s", "%v")
274306
filePath := filepath.Join(name, name)
275307
err = ioutil.WriteFile(filePath, []byte(fileTmpl), 0755)
276308
return err

0 commit comments

Comments
 (0)
X Tutup