mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
systemd-cryptenroll: use pager for --help, add --no-pager option
This commit is contained in:
@@ -728,6 +728,7 @@
|
||||
|
||||
<xi:include href="standard-options.xml" xpointer="help" />
|
||||
<xi:include href="standard-options.xml" xpointer="version" />
|
||||
<xi:include href="standard-options.xml" xpointer="no-pager" />
|
||||
</variablelist>
|
||||
|
||||
</refsect1>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "libfido2-util.h"
|
||||
#include "main-func.h"
|
||||
#include "memory-util.h"
|
||||
#include "pager.h"
|
||||
#include "parse-argument.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
@@ -54,6 +55,7 @@ static uint32_t arg_tpm2_public_key_pcr_mask = 0;
|
||||
static char *arg_tpm2_signature = NULL;
|
||||
static char *arg_tpm2_pcrlock = NULL;
|
||||
static char *arg_node = NULL;
|
||||
PagerFlags arg_pager_flags = 0;
|
||||
static int *arg_wipe_slots = NULL;
|
||||
static size_t arg_n_wipe_slots = 0;
|
||||
static WipeScope arg_wipe_slots_scope = WIPE_EXPLICIT;
|
||||
@@ -172,6 +174,8 @@ static int help(void) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
int r;
|
||||
|
||||
pager_open(arg_pager_flags);
|
||||
|
||||
r = terminal_urlify_man("systemd-cryptenroll", "1", &link);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
@@ -180,6 +184,7 @@ static int help(void) {
|
||||
"%5$sEnroll a security token or authentication credential to a LUKS volume.%6$s\n\n"
|
||||
" -h --help Show this help\n"
|
||||
" --version Show package version\n"
|
||||
" --no-pager Do not spawn a pager\n"
|
||||
" --list-devices List candidate block devices to operate on\n"
|
||||
" --wipe-slot=SLOT1,SLOT2,…\n"
|
||||
" Wipe specified slots\n"
|
||||
@@ -245,6 +250,7 @@ static int help(void) {
|
||||
static int parse_argv(int argc, char *argv[]) {
|
||||
enum {
|
||||
ARG_VERSION = 0x100,
|
||||
ARG_NO_PAGER,
|
||||
ARG_PASSWORD,
|
||||
ARG_RECOVERY_KEY,
|
||||
ARG_UNLOCK_KEYFILE,
|
||||
@@ -274,6 +280,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
static const struct option options[] = {
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version", no_argument, NULL, ARG_VERSION },
|
||||
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
|
||||
{ "password", no_argument, NULL, ARG_PASSWORD },
|
||||
{ "recovery-key", no_argument, NULL, ARG_RECOVERY_KEY },
|
||||
{ "unlock-key-file", required_argument, NULL, ARG_UNLOCK_KEYFILE },
|
||||
@@ -317,6 +324,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
case ARG_VERSION:
|
||||
return version();
|
||||
|
||||
case ARG_NO_PAGER:
|
||||
arg_pager_flags |= PAGER_DISABLE;
|
||||
break;
|
||||
|
||||
case ARG_FIDO2_WITH_PIN:
|
||||
r = parse_boolean_argument("--fido2-with-client-pin=", optarg, NULL);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user