PMQUERY(1)

πŸ“¦
version 7.2.2 Β· 2 versions
, in arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, ubuntu questing, ubuntu resolute, ubuntu stonking

PMQUERY(1) πŸ’…βœ¨

okay bestie, welcome to the group chat for pmquery β€” she lives in section 1 of the General Commands Manual and she's literally the queen of "hey, click a button for me" dialogs. Her government name is pmquery, and she brought her two besties pmconfirm and pmmessage along for the ride. πŸŽ€


✨ NAME ✨

pmconfirm, pmmessage, pmquery β€” general purpose dialog box πŸ’– (yes all three, they're a package deal, no cap)


✨ SYNOPSIS ✨

pmconfirm [-c] [-b button-name] [-B default-button-name] [-t string]
[-file filename] [-icon icontype] [-font font] [-header titlebar-string]
[-useslider] [-noslider] [-noframe] [-exclusive]

pmmessage [-buttons label1[:value1][,label2[:value2][,...]]]  [-center]
[-nearmouse] [-default button] [-file filename] [-print] [-timeout sec]
message...

pmquery [-input] [all above options...]  [message...]

like. look at her. three whole moods. πŸ¦‹


✨ DESCRIPTION ✨

pmquery is serving you a command-line-option compatible implementation of the xconfirm and xmessage tools, but with a look-and-feel that's consistent with pmchart. She did not come to play β€” several extensions to the functionality of the original tools have been made, so she's extra useful specifically for pmchart, but wherever possible the original semantics remain. (loyal to her roots fr fr 🌸)

pmconfirm displays a line of text for each -t option specified (or a file when the -file option is used), and a button for each -b option specified. When one of the buttons is pressed, the label of that button is written to pmquery's standard output. That's a whole means of communication/feedback from within shell scripts, and a means to display useful information to a user from an application. slay, honestly. πŸ‘‘

pmmessage displays a window containing a message from the command line, a file, or standard input. She additionally allows buttons to be associated with an exit status, and only optionally will write the label of the button to standard output. lowkey picky but we love her πŸ’œ

pmquery extends the above tools to additionally support limited user input, as free form text. In this -input mode, any text entered will be output when the default button is pressed. A default text can be entered using the same mechanisms as the other tools. main character energy, obviously. 🌈

Command line options are available to specify font style, frame style, modality and one of several different icons to be presented for tailored visual feedback to the user. it's giving customizable ✨


✨ OPTIONS ✨

The available command line options are:

  • -c, -center β€” Center the window on the display. 🎯
  • -nearmouse β€” Pop up the window near the mouse cursor. she follows your cursor around like a little duckling 🐭
  • -b button-name β€” Displays a button with the label button-name. If button-name is the empty string, the button in that position is not displayed. If no -b options are present, the default is a button with the label Continue. The exit status associated with button-name is zero. (so Continue = 0, periodt πŸ’…)
  • -B button-name β€” Displays a button with the label button-name and specifies it as the button to be activated when enter is pressed. The exit status associated with button-name is zero. she's the default queen, the one who answers when you hit return ⭐
  • -buttons button,button,... β€” This option will create one button for each comma-separated button option. Each button consists of a label optionally followed by a colon and an exit value. The exit value will be returned if that button is selected. The default exit value is 100 plus the button number. Buttons are numbered from the left starting with one. (so the first one is 101, iykyk πŸ“)
  • -default label β€” Defines the button with a matching label to be the default. If not specified there is no default. The corresponding resource is defaultButton. Pressing Return anywhere in the xmessage window will activate the default button. The default button has a wider border than the others. (wider border = she's built different 🫢)
  • -t message β€” Displays message. Any number of strings can be listed on the command line (each must be preceded with the -t option). stack 'em up πŸ“š
  • -file filename β€” Displays the file filename. All -t options will be ignored. A filename of - reads from standard input. ⚠️ careful bestie, that -t erasure is real
  • -icon icontype β€” Displays the icon icontype where icontype is one of: info, error, question, warning, critical. action is also accepted as a synonym for error for backward compatibility. pmquery introduces the additional archive and host icon types as well as the original xconfirm types listed earlier. so many lil faces to choose from πŸ˜­πŸ’–
  • -font fontname β€” Use fontname as the font. This option is only available when using the X Window System. πŸ–₯️
  • -header string β€” Use string as the window title. name her!! ✨
  • -print β€” This causes the program to write the label of the button pressed to standard output. It is the default behaviour for pmconfirm and pmquery. πŸ—£οΈ
  • -noprint β€” This causes the program to not write the label of the button pressed to standard output. It is the default behaviour for pmmessage. 🀫
  • -geometry geometry-string β€” This provides the tool with an X-compatible geometry string specification. This option is only available when using the X Window System. πŸ“
  • -useslider β€” When displaying a file, always use a slider instead of determining automatically whether a slider is necessary. no thoughts, just slider 🎚️
  • -noslider β€” Do not create a slider, and clip text to the window size, instead of determining automatically whether a slider is necessary.. (yes the double period is in the original, we respect her grammar choices πŸŽ€)
  • -noframe β€” Do not display a frame around the contents. minimalist era 🧚
  • -exclusive β€” Grab the keyboard/pointer and do not allow further input until a button is pressed. she is HOLDING you hostage until you decide, no cap πŸ’€
  • -timeout secs β€” Exit with status 0 after secs seconds if the user has not clicked on a button yet. The corresponding resource is timeout. ticking clock, bestie ⏰
  • -?, -h, -help β€” Display usage message and exit. the "help me help you" trio πŸ™ˆ

✨ EXAMPLES ✨

The following shell script will display a window with an information icon, asking the user a yes or no question with Yes as the default.

#! /bin/sh
case `pmquery -t "Really power down?" -b No -B Yes -icon question
in
  Yes) shutdown;;
  No) ;;
esac

A second example, which prompts for a hostname then starts a terminal with an ssh session connected to the requested host. πŸ–₯οΈπŸ”

#! /bin/sh
host=`pmquery -input -icon host -b Cancel -B OK \
              -header "Remote Terminal - Secure Shell"
[ "$host" = "Cancel" -o -z "$host" ] && exit
gnome-terminal -e "ssh $host"

✨ ENVIRONMENT ✨

pmquery is an excellent choice of utility for the PCP_XCONFIRM_PROG Performance Co-Pilot configuration parameter (refer to pcp.conf(5) for details). literally the moment πŸ’…

Note that PCP_XCONFIRM_PROG will be automatically set to pmquery inside tools like pmchart, unless PCP_XCONFIRM_PROG is already set in the environment. she self-nominates, iconic behavior πŸ‘‘


✨ EXIT STATUS ✨

If it detects an error, pmquery always returns 1, so this value should not be associated with a button. 🚨

Unless -button option has not been used, the return code will be zero on success. (yes, that's the sentence. read it twice, it's fine 🫠)


✨ SEE ALSO ✨

pmchart(1) and pcp.conf(5). go read your sisters' pages, bestie πŸ“–πŸ’œ


and that's the whole vibe check, babe β€” this page came from Performance Co-Pilot, and she's rocking the PMQUERY(1) tag. mwah, go click a button, love you, bye πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from