Syncs the latest two entries from Nightscout to a file the can be consumed by your command line prompt (a.k.a. $PS1
).
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
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 "my-nightscout-url.com" -c ~/.nightscout-ps1.env
Replace my-nightscout-url.com
with the actual URL to your own Nightscout
deployment.
Flag | Description |
---|---|
--cache-file /-c |
Path to write the latest reading file. Must end in .env or .json , and may be specified more than once.Defaults to ~/.nightscout-ps1.env . |
--nightscout /-n |
URL of your Nightscout deployment. |
cp service/io.n8.nightscout-ps1.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/io.n8.nightscout-ps1.plist
Then see Configuring your PS1
below.
cp service/nightscout-ps1.service /etc/systemd/system/
sudo systemd start nightscout-ps1
sudo systemd enable nightscout-ps1
Then see Configuring your PS1
below.
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
First, install import
.
Second, add the following to your .bashrc
file:
. "$(which import)"
import "tootallnate/nightscout-ps1@3.1.0"
export PS1="\$(nightscout_ps1) \$ "
Be sure to add further customizations to your PS1
to your liking!
The --cache-file
/-c
flag determines how to format the output file based on the
file extension. These are the supported format types:
Formatted with key=value
pairs that may be source
or eval
'd in a shell
script (i.e. your .bashrc
file). Example.
Formatted as a JSON file, which may consumed by jq
or other related tools.
Example.