kopia lustrzana https://github.com/muesli/mastotool
Automatically prefix 'https' if the protocol is missing from the URL
rodzic
3f563e17e6
commit
5b70cc0c1a
6
main.go
6
main.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
mastodon "github.com/mattn/go-mastodon"
|
mastodon "github.com/mattn/go-mastodon"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -65,7 +66,12 @@ func initClient() error {
|
||||||
if scanner.Err() != nil {
|
if scanner.Err() != nil {
|
||||||
return fmt.Errorf("Can't open input: %s", err)
|
return fmt.Errorf("Can't open input: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = scanner.Text()
|
instance = scanner.Text()
|
||||||
|
if !strings.HasPrefix(instance, "http") {
|
||||||
|
instance = "https://" + instance
|
||||||
|
}
|
||||||
|
|
||||||
config.Set("instance", instance)
|
config.Set("instance", instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue