3 changed files with 49 additions and 0 deletions
@ -0,0 +1,8 @@ |
|||||||
|
module mod |
||||||
|
|
||||||
|
go 1.17 |
||||||
|
|
||||||
|
require ( |
||||||
|
github.com/jessevdk/go-flags v1.5.0 // indirect |
||||||
|
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect |
||||||
|
) |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= |
||||||
|
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= |
||||||
|
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc= |
||||||
|
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||||
@ -0,0 +1,37 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"strings" |
||||||
|
|
||||||
|
"github.com/jessevdk/go-flags" |
||||||
|
) |
||||||
|
|
||||||
|
type Options struct { |
||||||
|
Telegram bool `short:"t" long:"telegram-send" description:"Send to telegram"` |
||||||
|
Telegramtoken string `short:"k" long:"telegram-token" description:"Token for send to telegram"` |
||||||
|
VK bool `short:"v" long:"vk-send" description:"Send to vk"` |
||||||
|
VKtoken string `short:"b" long:"vk-token" description:"Token for send to VK"` |
||||||
|
Facebook bool `short:"f" long:"fb-send" description:"Send to Facebook"` |
||||||
|
FBtoken string `short:"m" long:"fb-token" description:"Token for send to Facebook"` |
||||||
|
} |
||||||
|
|
||||||
|
func main() { |
||||||
|
var options Options |
||||||
|
var parser = flags.NewParser(&options, flags.Default) |
||||||
|
// parser.CommandHandler = func(command flags.Commander, args []string) error {
|
||||||
|
// print(options.Telegram)
|
||||||
|
// }
|
||||||
|
args, err := parser.Parse() |
||||||
|
if err != nil { |
||||||
|
panic(err) |
||||||
|
} |
||||||
|
|
||||||
|
fmt.Printf("Telegram send: %v\n", options.Telegram) |
||||||
|
fmt.Printf("Telegram token: %s\n", options.Telegramtoken) |
||||||
|
fmt.Printf("VK send: %v\n", options.VK) |
||||||
|
fmt.Printf("VK token: %s\n", options.VKtoken) |
||||||
|
fmt.Printf("Facebook send: %v\n", options.Facebook) |
||||||
|
fmt.Printf("Facebook token: %s\n", options.FBtoken) |
||||||
|
fmt.Printf("Remaining args: %s\n", strings.Join(args, " ")) |
||||||
|
} |
||||||
Loading…
Reference in new issue