examples/

directory
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2023 License: Apache-2.0

README

Examples

Shell

This is a basic snippet with shell command:

$ echo "Hello, runme!"

With {name=hello} you can annotate it and give it a nice name:

$ echo "Hello, runme!"

It can contain multiple lines too:

$ echo "1"
$ echo "2"
$ echo "3"

Also, the dollar sign is not needed:

echo "Hello, runme! Again!"

It works with cd, pushd, and similar because all lines are executed as a single script:

temp_dir=$(mktemp -d -t "runme-XXXXXXX")
pushd $temp_dir
echo "hi!" > hi.txt
pwd
cat hi.txt
popd
pwd

Sometimes, shell scripts fail:

echo ok
exit 1
Interactive Scripts
echo -n "Enter your name: "
read name
echo "\nHi, $name!"

JavaScript

It can also execute a snippet of JavaScript code:

console.log("Hello World!")

Go

It can also execute a snippet of Go code:

package main

import (
    "fmt"
)

func main() {
    fmt.Println("Hello from Go, runme!")
}

Unknown snippets

Snippets without provided type are ignored.

To still display unknown snippets, provide --allow-unknown to the list command.

[database]
username = admin
password = admin

Categories

echo "Category A"
echo "Category A,B"
echo "Category A,B,C"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL