projects/pwm

changeset 15:3380c8fd9776

Show all record fields except the password by default
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Mon Aug 07 19:11:56 2017 +0200 (2017-08-07)
parents a01899a6e4bb
children a07665727c19
files cmd.c pwm.1.xml
line diff
     1.1 --- a/cmd.c	Mon Aug 07 18:16:47 2017 +0200
     1.2 +++ b/cmd.c	Mon Aug 07 19:11:56 2017 +0200
     1.3 @@ -720,7 +720,16 @@
     1.4  	struct record	*record;
     1.5  	int		i;
     1.6  	enum field_type	type;
     1.7 -	int		fields[COUNTOF(field_namev) - 1] = { 0 };
     1.8 +	int		fields[COUNTOF(field_namev) - 1] = {
     1.9 +		[FIELD_GROUP] = 1,
    1.10 +		[FIELD_TITLE] = 1,
    1.11 +		[FIELD_USERNAME] = 1,
    1.12 +		[FIELD_PASSWORD] = 0,
    1.13 +		[FIELD_NOTES] = 1,
    1.14 +		[FIELD_URL] = 1,
    1.15 +		[FIELD_MTIME] = 1,
    1.16 +		[FIELD_CTIME] = 1
    1.17 +	};
    1.18  
    1.19  	if (argc < 2) {
    1.20  		return (CMD_USAGE);
    1.21 @@ -731,6 +740,11 @@
    1.22  		return (CMD_ERR);
    1.23  	}
    1.24  
    1.25 +	if (argc > 2) {
    1.26 +		/* show only explicitly given field names */
    1.27 +		memset(fields, 0, sizeof (fields));
    1.28 +	}
    1.29 +
    1.30  	for (i = 2; i < argc; i++) {
    1.31  		type = parse_arg(argv[i], field_namev, '\0', NULL);
    1.32  		if (type < 0) {
     2.1 --- a/pwm.1.xml	Mon Aug 07 18:16:47 2017 +0200
     2.2 +++ b/pwm.1.xml	Mon Aug 07 19:11:56 2017 +0200
     2.3 @@ -310,7 +310,8 @@
     2.4                <sbr/>
     2.5              </cmdsynopsis>
     2.6              <para>Display each <replaceable>field</replaceable> of the entry
     2.7 -            identified by <replaceable>id</replaceable>.</para>
     2.8 +            identified by <replaceable>id</replaceable>. If no field is
     2.9 +            specified, display all fields except the password field.</para>
    2.10            </listitem>
    2.11          </varlistentry>
    2.12          <varlistentry>