From 9370dbcc47855e11cb24c3cfd29af416eced29d9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 20 Sep 2023 21:44:00 +0100 Subject: [PATCH] lsjson: make sure we set the global metadata flag too --- cmd/lsjson/lsjson.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/lsjson/lsjson.go b/cmd/lsjson/lsjson.go index 764ff2b94..00cb0f4b6 100644 --- a/cmd/lsjson/lsjson.go +++ b/cmd/lsjson/lsjson.go @@ -117,6 +117,12 @@ can be processed line by line as each item is written one to a line. "groups": "Filter,Listing", }, RunE: func(command *cobra.Command, args []string) error { + // Make sure we set the global Metadata flag too as it + // isn't parsed by cobra. We need to do this first + // before any backends are created. + ci := fs.GetConfig(context.Background()) + ci.Metadata = opt.Metadata + cmd.CheckArgs(1, 1, command, args) var fsrc fs.Fs var remote string