Documentation
¶
Overview ¶
Package specialcmd handles special (aka. "magic") commands, that come in two flavors:
- `%<cmd> {...args...}`: Control the environment (variables) and configure gonb.
- `!<shell commands>`: Execute shell commands. Similar to the ipython kernel.
In particular `%help` will print out currently available commands.
Index ¶
Constants ¶
const MillisecondsWaitForInput = 200
MillisecondsWaitForInput is the wait time for a bash script (started with `!` or `!*` special commands, when `%with_inputs` or `%with_password` is used) to run, before an input is prompted to the Jupyter Notebook.
Variables ¶
var (
CellSpecialCommands = SetWithValues(
"%%writefile",
"%%script",
"%%bash",
"%%sh")
)
var HelpMessage string
Functions ¶
func ExecuteSpecialCell ¶ added in v0.10.0
func ExecuteSpecialCell(msg kernel.Message, goExec *goexec.State, lines []string) (isSpecialCell bool, err error)
ExecuteSpecialCell checks whether it is a special cell (see CellSpecialCommands), and if so it executes the special cell command.
It returns if this was a special cell (if true it executes it), and potentially an execution error, if one happened.
func IsGoCell ¶ added in v0.10.0
IsGoCell returns whether the cell is expected to be a Go cell, based on the first line.
The first line may contain special commands that change the interpretation of the cell, e.g.: "%%script", "%%writefile".
func Parse ¶
func Parse(msg kernel.Message, goExec *goexec.State, execute bool, codeLines []string, usedLines Set[int]) (err error)
Parse will check whether the given code to be executed has any special commands.
Any special commands found in the code will be executed (if execute is set to true) and the corresponding lines used from the code will be returned in usedLines -- so they can be excluded from other executors (goexec).
If any errors happen, it is returned in err.
Types ¶
This section is empty.