Skip to content

AndreasArvidsson/bashbook

Repository files navigation

BashBook

Notebook for running bash/shell script

example ls

Creating a BashBook

BashBook the way you would any normal notebook

  1. Open a file with the .bashbook extension
  2. New File... / Bash Notebook
  3. Command / BashBook: Create new Bash Notebook

Commands

  • Create new Bash Notebook
  • Open notebook as markdown
  • Open all outputs in new file
  • Execute cell and select content
  • Execute cell and clear content
  • Execute and show output in below markdown cell
  • Clear cell content and edit
  • Copy cell output
  • Open cell output in new file

Details

One shell per notebook

Each notebook is running one continuous shell. This means that commands running in one cell will effect the others. Only one execution is allowed at the time and the rest is queued.

Interactive terminal (prompt)

Interaction with running execution is possible in the output terminal. Finished executions are non-interactive.

example prompt

Resize

  • Resizes terminal height to fit content dynamically
  • Resizes terminal width at end of execution. Only affects next execution.

Current Working Directory(CWD)

Tries to set CWD in following order

  1. File directory
  2. Workspace directory
  3. User home directory

Problem with Ubuntu/Debian

On a Ubuntu/Debian system you may get a Cannot open resource with notebook editor error if vscode is installed as a flatpack(Ubuntu Software). For BashBook to work correctly vscode needs to be installed with apt install

Build details

Build local

npm install

# Run after each install
npm run rebuild

npm run compile

# Build `.vsix` file
npm run package

Dependencies

Due to node-pty we have platform specific dependencies
node-pty dependencies

Components

  • node-pty
  • xterm.js

Rebuild node-pty with correct electron version

If you get an error NODE_MODULE_VERSION mismatch.

  1. Check the version of electron vscode is using. Help => About => Electron
  2. Make sure you have the correct version of electron in package.json. List of electron versions is available here
  3. Run npm run rebuild