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