diff --git a/Makefile b/Makefile index ea0a1a5e..b2ef9d32 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ SUBDIRS := etc www docs USR_BIN := \ proxmox-backup-client \ pxar \ - pmtx + pmtx \ + pmt # Binaries usable by admins USR_SBIN := \ diff --git a/debian/pmt.bc b/debian/pmt.bc new file mode 100644 index 00000000..cb32b336 --- /dev/null +++ b/debian/pmt.bc @@ -0,0 +1,3 @@ +# pmt bash completion + +complete -C 'pmt bashcomplete' pmt diff --git a/debian/proxmox-backup-server.bash-completion b/debian/proxmox-backup-server.bash-completion index 712677c1..06d74f1c 100644 --- a/debian/proxmox-backup-server.bash-completion +++ b/debian/proxmox-backup-server.bash-completion @@ -1,2 +1,3 @@ debian/proxmox-backup-manager.bc proxmox-backup-manager debian/pmtx.bc pmtx +debian/pmt.bc pmt diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install index c53e09fa..8f877e25 100644 --- a/debian/proxmox-backup-server.install +++ b/debian/proxmox-backup-server.install @@ -11,6 +11,7 @@ usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-daily-update usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd usr/sbin/proxmox-backup-manager usr/bin/pmtx +usr/bin/pmt usr/share/javascript/proxmox-backup/index.hbs usr/share/javascript/proxmox-backup/css/ext6-pbs.css usr/share/javascript/proxmox-backup/images @@ -18,5 +19,7 @@ usr/share/javascript/proxmox-backup/js/proxmox-backup-gui.js usr/share/man/man1/proxmox-backup-manager.1 usr/share/man/man1/proxmox-backup-proxy.1 usr/share/man/man1/pmtx.1 +usr/share/man/man1/pmt.1 usr/share/zsh/vendor-completions/_proxmox-backup-manager usr/share/zsh/vendor-completions/_pmtx +usr/share/zsh/vendor-completions/_pmt diff --git a/docs/Makefile b/docs/Makefile index 06bdadb9..c80cc078 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,12 +6,14 @@ GENERATED_SYNOPSIS := \ proxmox-backup-manager/synopsis.rst \ pxar/synopsis.rst \ pmtx/synopsis.rst \ + pmt/synopsis.rst \ backup-protocol-api.rst \ reader-protocol-api.rst MANUAL_PAGES := \ pxar.1 \ pmtx.1 \ + pmt.1 \ proxmox-backup-proxy.1 \ proxmox-backup-client.1 \ proxmox-backup-manager.1 @@ -77,6 +79,13 @@ pmtx.1: pmtx/man1.rst pmtx/description.rst pmtx/synopsis.rst rst2man $< >$@ +pmt/synopsis.rst: ${COMPILEDIR}/pmt + ${COMPILEDIR}/pmt printdoc > pmt/synopsis.rst + +pmt.1: pmt/man1.rst pmt/description.rst pmt/synopsis.rst + rst2man $< >$@ + + proxmox-backup-client/synopsis.rst: ${COMPILEDIR}/proxmox-backup-client ${COMPILEDIR}/proxmox-backup-client printdoc > proxmox-backup-client/synopsis.rst diff --git a/docs/pmt/description.rst b/docs/pmt/description.rst new file mode 100644 index 00000000..dd95145d --- /dev/null +++ b/docs/pmt/description.rst @@ -0,0 +1,5 @@ +Description +^^^^^^^^^^^ + +The ``pmt`` command controls Linux tape devices. + diff --git a/docs/pmt/man1.rst b/docs/pmt/man1.rst new file mode 100644 index 00000000..428c26d2 --- /dev/null +++ b/docs/pmt/man1.rst @@ -0,0 +1,48 @@ +========================== +pmt +========================== + +.. include:: ../epilog.rst + +------------------------------------------------------------- +Control Linux Tape Devices +------------------------------------------------------------- + +:Author: |AUTHOR| +:Version: Version |VERSION| +:Manual section: 1 + + +Synopsis +======== + +.. include:: synopsis.rst + + +Common Options +============== + +All command supports the following parameters to specify the tape device: + +--device Path to the Linux tape device + +--drive Use drive from Proxmox Backup Server configuration. + + +Commands generation output supports the ``--output-format`` parameter. It accepts +the following values: + +:``text``: Text format (default). Human readable. + +:``json``: JSON (single line). + +:``json-pretty``: JSON (multiple lines, nicely formatted). + + +Description +=========== + +.. include:: description.rst + + +.. include:: ../pbs-copyright.rst diff --git a/src/bin/pmt.rs b/src/bin/pmt.rs index 13bb057c..c6389f38 100644 --- a/src/bin/pmt.rs +++ b/src/bin/pmt.rs @@ -922,6 +922,7 @@ fn main() -> Result<(), Error> { }; let cmd_def = CliCommandMap::new() + .usage_skip_options(&["device", "drive", "output-format"]) .insert("asf", std_cmd(&API_METHOD_ASF).arg_param(&["count"])) .insert("bsf", std_cmd(&API_METHOD_BSF).arg_param(&["count"])) .insert("bsfm", std_cmd(&API_METHOD_BSFM).arg_param(&["count"])) diff --git a/zsh-completions/_pmt b/zsh-completions/_pmt new file mode 100644 index 00000000..dc418dfa --- /dev/null +++ b/zsh-completions/_pmt @@ -0,0 +1,13 @@ +#compdef _pmt() pmt + +function _pmt() { + local cwords line point cmd curr prev + cworkds=${#words[@]} + line=$words + point=${#line} + cmd=${words[1]} + curr=${words[cwords]} + prev=${words[cwords-1]} + compadd -- $(COMP_CWORD="$cwords" COMP_LINE="$line" COMP_POINT="$point" \ + pmt bashcomplete "$cmd" "$curr" "$prev") +}