mirror of
https://github.com/rclone/rclone.git
synced 2024-12-23 23:49:15 +01:00
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`.
This commit is contained in:
parent
8656bd2bb0
commit
94950258a4
7
fs/fs.go
7
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
|
||||
|
Loading…
Reference in New Issue
Block a user