rename helper function;
This commit is contained in:
parent
23de9a3db7
commit
3f365a715f
|
|
@ -48,7 +48,8 @@ type TelegramConfig struct {
|
|||
}
|
||||
|
||||
type DiscordConfig struct {
|
||||
Token string
|
||||
Token string
|
||||
ProjectsChannelID string
|
||||
}
|
||||
|
||||
type ApplicationConfig struct {
|
||||
|
|
@ -92,7 +93,8 @@ func InitConfig(envFilePath string) Config {
|
|||
Token: os.Getenv("TG_API"),
|
||||
},
|
||||
Discord: DiscordConfig{
|
||||
Token: os.Getenv("DISCORD_TOKEN"),
|
||||
Token: os.Getenv("DISCORD_TOKEN"),
|
||||
ProjectsChannelID: os.Getenv("PROJECTS_CHANNEL_GROUP"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
func ValidNaming(input string) string {
|
||||
func Cut(input string) string {
|
||||
// Remove leading and trailing whitespace
|
||||
input = strings.TrimSpace(input)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ var tests = []test{
|
|||
func TestGitNaming(t *testing.T) {
|
||||
|
||||
for _, test := range tests {
|
||||
if output := ValidNaming(test.arg); output != test.expected {
|
||||
if output := Cut(test.arg); output != test.expected {
|
||||
t.Errorf("Output %q not equal to expected %q", output, test.expected)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ func (c *Cloud) CreateFolder(name string) Response {
|
|||
davPath := "/remote.php/dav/files/"
|
||||
parentPath := "/apps/files/?dir="
|
||||
|
||||
name = helpers.ValidNaming(name)
|
||||
name = helpers.Cut(name)
|
||||
|
||||
R.Folder = &domain.Folder{
|
||||
Title: name,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ type gitCreateRequest struct {
|
|||
}
|
||||
|
||||
func (gb *Git) newRepo(name string) (*domain.Git, error) {
|
||||
name = helpers.ValidNaming(name)
|
||||
name = helpers.Cut(name)
|
||||
|
||||
payload := gitCreateRequest{
|
||||
Name: name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue