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