Nagging Penguin Matriarchs
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

nightscout-ps1

3.0.1 • Public • Published

nightscout-ps1

A daemon that periodically syncs the latest two entries from Nightscout to a file the can be consumed by your command line prompt (a.k.a. $PS1).

Installation

Preferred installation is by downloading a pre-compiled binary for your platform:

If there is no binary for your platform, or you would simply like to install from source, you may install from the npm registry:

$ npm install -g nightscout-ps1

Usage

The flags for usage of nightscout-ps1 are listed here, however it is highly recommended that you set up the daemon as a "service" for your operating system.

$ nightscout-ps1 -n <Nightscout URL> -c ~/.nightscout-ps1.env
Flag Description
--cache-file/-c Path to write the latest reading file. Must end in .env or .json, may be specified more than once. Defaults to ~/.nightscout-ps1.env.
--nightscout/-n URL of your Nightscout deployment

Setup on macOS

cp config/bash.sh ~/.nightscout-ps1
cp service/io.n8.nightscout-ps1.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/io.n8.nightscout-ps1.plist

Then see Configuring your PS1 below.

Setup on Linux

cp config/bash.sh ~/.nightscout-ps1
cp service/nightscout-ps1.service /etc/systemd/system/
sudo systemd start nightscout-ps1
sudo systemd enable nightscout-ps1

Then see Configuring your PS1 below.

Setup on Windows

Check out this blog post by Scott Hanselman to setup as a Windows Service:

Visualizing your real-time blood sugar values AND a Git Prompt on Windows PowerShell and Linux Bash

Configuring your PS1

The files in the config directory include pre-configured functions for reading the cache files created by nightscout-ps1.

For example, to consume the bash function in your .bashrc file, add something like:

source ~/.nightscout-ps1
 
export PS1="\$(nightscout_ps1) \$ "

Be sure to add further customizations to your PS1 to your liking!

Formats

The --cache-file/-c flag determines how to format the output file based on the file extension. These are the supported format types:

.env

Formatted with key=value pairs that may be source or eval'd in a shell script (i.e. your .bashrc file). Example.

.json

Formatted as a JSON file, which may consumed by jq or other related tools. Example.

Keywords

none

install

npm i nightscout-ps1

Downloadsweekly downloads

0

version

3.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability