Add help string
This commit is contained in:
parent
c23282c0aa
commit
4d5053a101
53
bambu.sh
53
bambu.sh
|
@ -1,10 +1,56 @@
|
|||
#!/usr/bin/env bash
|
||||
CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/bambu.conf.sh"
|
||||
|
||||
function usage() {
|
||||
cat <<EOF
|
||||
Command: $0 [--debug] [--raw-output] <subcommand> [args] ...
|
||||
Command line client for controlling Bambu Labs 3D printers.
|
||||
|
||||
This script relies on a configuration file located at $CONFIG_PATH.
|
||||
The configuration file should be a Bash script that sets the following variables:
|
||||
|
||||
BAMBU_IP
|
||||
BAMBU_SERIAL
|
||||
BAMBU_ACCESS_CODE
|
||||
|
||||
Subcommands:
|
||||
help - Print this help message
|
||||
status - Display current status of the printer
|
||||
file
|
||||
ls [--list-only] [--file] [path]
|
||||
- List <path> on the printer's SD card.
|
||||
If "--list-only" is specified, only print out the names
|
||||
of files without metadata (timestamp, etc.).
|
||||
If "--file" is specified, then <path> is assumed
|
||||
to be a file, and it is listed on its own instead of
|
||||
trying to list its children.
|
||||
get [-o|--output <output_directory>] <remote_file>
|
||||
- Download <remote_file> to <output_directory> (\$PWD by default)
|
||||
put <local_file> <remote_directory>
|
||||
- Upload <local_file> to <remote_directory>
|
||||
rm [-r|--recursive] <path>
|
||||
- Delete the remote <path> on the printer.
|
||||
If "-r" is specified, assume <path> is a directory and
|
||||
delete all of its children, including itself.
|
||||
print
|
||||
start [--timelapse] [--no-bed-leveling] [--no-vibration-calibration]
|
||||
[--flow-calibration] <remote_file>
|
||||
- Start a print job with <remote_file>. Only single-plate 3mf
|
||||
files are supported.
|
||||
pause|resume|stop
|
||||
- As names suggest.
|
||||
check
|
||||
- Check the current print status from the printer and output
|
||||
any potential error codes.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
function die() {
|
||||
echo "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/bambu.conf.sh"
|
||||
[ ! -f "$CONFIG_PATH" ] && die "Config file $CONFIG_PATH not found"
|
||||
|
||||
source "$CONFIG_PATH"
|
||||
|
@ -94,7 +140,7 @@ function bambu_file() {
|
|||
ls)
|
||||
bambu_ls "$@"
|
||||
;;
|
||||
put])
|
||||
put)
|
||||
bambu_put "$@"
|
||||
;;
|
||||
rm)
|
||||
|
@ -353,6 +399,9 @@ case "$command" in
|
|||
print)
|
||||
bambu_print "$@"
|
||||
;;
|
||||
help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
die "Unknown command $command"
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue