splitted one operator module to file, account, image operators; splitted operator functions; etc
This commit is contained in:
+12
-12
@@ -3,8 +3,8 @@ package filecli
|
||||
import (
|
||||
"net/url"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -17,13 +17,13 @@ type Repository struct {
|
||||
urlobj *url.URL
|
||||
user, pass string
|
||||
resource string
|
||||
values url.Values
|
||||
values url.Values
|
||||
}
|
||||
|
||||
func ParsePath(rawpath string) (*Repository, error) {
|
||||
repo := &Repository{
|
||||
values: url.Values{},
|
||||
}
|
||||
values: url.Values{},
|
||||
}
|
||||
if !strings.Contains(rawpath, "://") {
|
||||
rawpath = "https://" + rawpath
|
||||
}
|
||||
@@ -39,17 +39,17 @@ func ParsePath(rawpath string) (*Repository, error) {
|
||||
repo.resource = path.Join("/", urlobj.Path)
|
||||
urlobj.Path = "/"
|
||||
repo.urlobj = urlobj
|
||||
repo.values = urlobj.Query()
|
||||
repo.values = urlobj.Query()
|
||||
return repo, err
|
||||
}
|
||||
|
||||
func (repo *Repository) Raw() string {
|
||||
res := path.Join(repo.urlobj.Host, repo.resource)
|
||||
query := repo.values.Encode()
|
||||
if query != "" {
|
||||
return res + "?" + query
|
||||
}
|
||||
return res
|
||||
query := repo.values.Encode()
|
||||
if query != "" {
|
||||
return res + "?" + query
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (repo *Repository) SetResource(resource string) {
|
||||
@@ -61,11 +61,11 @@ func (repo *Repository) JoinResource(resource string) {
|
||||
}
|
||||
|
||||
func (repo *Repository) PathType(typ string) {
|
||||
repo.values.Set("pathType", typ)
|
||||
repo.values.Set("pathType", typ)
|
||||
}
|
||||
|
||||
func (repo *Repository) DryRun(yesno bool) {
|
||||
repo.values.Set("dryRun", strconv.FormatBool(yesno))
|
||||
repo.values.Set("dryRun", strconv.FormatBool(yesno))
|
||||
}
|
||||
|
||||
func (repo *Repository) File() string {
|
||||
|
||||
Reference in New Issue
Block a user