[glib: 1/2] gio-tool: -d option to delete attribute
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gio-tool: -d option to delete attribute
- Date: Fri, 5 Aug 2022 19:21:59 +0000 (UTC)
commit ece66f11fc3346fa1138d33cfa902800ee562de3
Author: codeboybebop <codeboy bebop gmail com>
Date: Sat Jul 30 15:14:09 2022 -0500
gio-tool: -d option to delete attribute
gio tool has support for deleting attributes of the file. To delete attribute user
should specify type '--type="unset"'. This is not mentioned in help and therefore not
intuitive. By adding '-d' option, we make this process more obvious.
closes #2588
gio/gio-tool-set.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gio/gio-tool-set.c b/gio/gio-tool-set.c
index 57ef4717b2..02622ba9ed 100644
--- a/gio/gio-tool-set.c
+++ b/gio/gio-tool-set.c
@@ -30,10 +30,12 @@
static char *attr_type = "string";
static gboolean nofollow_symlinks = FALSE;
+static gboolean delete = FALSE;
static const GOptionEntry entries[] = {
{ "type", 't', 0, G_OPTION_ARG_STRING, &attr_type, N_("Type of the attribute"), N_("TYPE") },
{ "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don’t follow symbolic links"),
NULL },
+ { "delete", 'd', 0, G_OPTION_ARG_NONE, &delete, N_("Unset given attribute"), NULL },
G_OPTION_ENTRY_NULL
};
@@ -127,8 +129,15 @@ handle_set (int argc, char *argv[], gboolean do_help)
}
attribute = argv[2];
+ if (delete)
+ {
+ type = G_FILE_ATTRIBUTE_TYPE_INVALID;
+ }
+ else
+ {
+ type = attribute_type_from_string (attr_type);
+ }
- type = attribute_type_from_string (attr_type);
if ((argc < 4) && (type != G_FILE_ATTRIBUTE_TYPE_INVALID))
{
show_help (context, _("Value not specified"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]