Repository: rclone/rclone (language: go)

Issue:
`rclone listremotes --long` output changed in v1.68.0 breaks existing automation
`rclone listremotes --long` output changed in the latest beta and it creates havoc in my multiple scripts.

I do not think this change is needed at all as what is the meaning of `file`???

The key problem is that such changes break any existing automation relying on rclone output.

If required maybe it can be added behind some optional flag? Leaving `rclone listremotes --long` as it was.

in rclone v1.67.0

```
$ rclone listremotes --long
.OD01-UNION:            union
.TestWithDot:           alias
.od01_a:                onedrive       test@outlook.com
.od01_b:                onedrive       test1@outlook.com
1fichier:               fichier
CCCc:                   combine
GPhoto:                 google photos
MemTest1:               memory
OD01-ENC:               crypt
OD01-ENC-ARC:           chunker
PikPak:                 pikpak
...
```

in rclone v1.68.0
```
$ rclone-beta listremotes --long
combine:                combine       file
unionXYZ:               union         file
alias:                  alias         file
backblaze:              b2            file
crypt_od01_kapitainsky: crypt         file
.od01_a:                onedrive      file test@outlook.com
.od01_b:                onedrive      file test1@outlook.com
```


Discussion / hints:
I think we need to make that backwards compatible @albertony

Having the environment defined ones in there too is great but we probably don't need to call them out.
> I do not think this change is needed at all as what is the meaning of file???

The text can be `file` or `environment`, to show where the remote definition came from - config file or environment variables. I thought it could be informative, and also there is an unlikely situation where one could have a remote with same name defined in both places and then this helps avoid any confusion regarding which one rclone considers.

> The key problem is that such changes break any existing automation relying on rclone output.

There is now `--json` for machine readable output. Hopefully that can be used for such things in future.
> There is now `--json` for machine readable output. Hopefully that can be used for such things in future.

Sure it can and is the right way moving forward but there is no reason to change it for non json output. I have users using older rclone versions (for various reasons) and it is pain for existing automation when output format changes out of the blue.

Fix patch:
diff --git a/cmd/listremotes/listremotes.go b/cmd/listremotes/listremotes.go
index 642306ab81051..684a10cf06a56 100644
--- a/cmd/listremotes/listremotes.go
+++ b/cmd/listremotes/listremotes.go
@@ -30,11 +30,11 @@ var (
 func init() {
 	cmd.Root.AddCommand(commandDefinition)
 	cmdFlags := commandDefinition.Flags()
-	flags.BoolVarP(cmdFlags, &listLong, "long", "", false, "Show type, source and description in addition to name", "")
+	flags.BoolVarP(cmdFlags, &listLong, "long", "", false, "Show type and description in addition to name", "")
 	flags.StringVarP(cmdFlags, &filterName, "name", "", "", "Filter remotes by name", "")
 	flags.StringVarP(cmdFlags, &filterType, "type", "", "", "Filter remotes by type", "")
-	flags.StringVarP(cmdFlags, &filterSource, "source", "", "", "filter remotes by source", "")
-	flags.StringVarP(cmdFlags, &filterDescription, "description", "", "", "filter remotes by description", "")
+	flags.StringVarP(cmdFlags, &filterSource, "source", "", "", "Filter remotes by source, e.g. 'file' or 'environment'", "")
+	flags.StringVarP(cmdFlags, &filterDescription, "description", "", "", "Filter remotes by description", "")
 	flags.StringVarP(cmdFlags, &orderBy, "order-by", "", "", "Instructions on how to order the result, e.g. 'type,name=descending'", "")
 	flags.BoolVarP(cmdFlags, &jsonOutput, "json", "", false, "Format output as JSON", "")
 }
@@ -120,9 +120,9 @@ or the remotes matching an optional filter.
 
 Prints the result in human-readable format by default, and as a simple list of
 remote names, or if used with flag ` + "`--long`" + ` a tabular format including
-all attributes of the remotes: name, type, source and description. Using flag
-` + "`--json`" + ` produces machine-readable output instead, which always includes
-all attributes.
+the remote names, types and descriptions. Using flag ` + "`--json`" + ` produces
+machine-readable output instead, which always includes all attributes - including
+the source (file or environment).
 
 Result can be filtered by a filter argument which applies to all attributes,
 and/or filter flags specific for each attribute. The values must be specified
@@ -157,7 +157,6 @@ according to regular rclone filtering pattern syntax.
 		remotes := config.GetRemotes()
 		maxName := 0
 		maxType := 0
-		maxSource := 0
 		i := 0
 		for _, remote := range remotes {
 			include := true
@@ -181,9 +180,6 @@ according to regular rclone filtering pattern syntax.
 				if len(remote.Type) > maxType {
 					maxType = len(remote.Type)
 				}
-				if len(remote.Source) > maxSource {
-					maxSource = len(remote.Source)
-				}
 				remotes[i] = remote
 				i++
 			}
@@ -225,7 +221,7 @@ according to regular rclone filtering pattern syntax.
 			fmt.Println("]")
 		} else if listLong {
 			for _, remote := range remotes {
-				fmt.Printf("%-*s %-*s %-*s %s\n", maxName+1, remote.Name+":", maxType, remote.Type, maxSource, remote.Source, remote.Description)
+				fmt.Printf("%-*s %-*s %s\n", maxName+1, remote.Name+":", maxType, remote.Type, remote.Description)
 			}
 		} else {
 			for _, remote := range remotes {


Test patch: