From 94950258a4151dbe73ac9230b5b9cc23d2fe6aa1 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 8 Aug 2018 09:23:03 +0100 Subject: [PATCH] fs: allow backends to be named using their Name or Prefix #2449 This means that, for example Google Cloud Storage can be known as `:gcs:bucket` on the command line, as well as `:google cloud storage:bucket`. --- fs/fs.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/fs.go b/fs/fs.go index 18e2ece0d..34b4f13b6 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -827,16 +827,17 @@ type ObjectPair struct { Src, Dst Object } -// Find looks for an Info object for the name passed in +// Find looks for an RegInfo object for the name passed in. The name +// can be either the Name or the Prefix. // // Services are looked up in the config file func Find(name string) (*RegInfo, error) { for _, item := range Registry { - if item.Name == name { + if item.Name == name || item.Prefix == name { return item, nil } } - return nil, errors.Errorf("didn't find filing system for %q", name) + return nil, errors.Errorf("didn't find backend called %q", name) } // MustFind looks for an Info object for the type name passed in