mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 10:12:37 +02:00
init project
This commit is contained in:
commit
0cc636e7b6
8
go.mod
Normal file
8
go.mod
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module github.com/celogeek/piwigo-cli
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/jessevdk/go-flags v1.5.0 // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 // indirect
|
||||||
|
)
|
4
go.sum
Normal file
4
go.sum
Normal file
@ -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=
|
24
login.go
Normal file
24
login.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type LoginCommand struct {
|
||||||
|
Url string `short:"u" long:"url" description:"Url of the instance"`
|
||||||
|
Login string `short:"l" long:"login" description:"Login"`
|
||||||
|
Password string `short:"p" long:"password" description:"Password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var loginCommand LoginCommand
|
||||||
|
|
||||||
|
func (c *LoginCommand) Execute(args []string) error {
|
||||||
|
fmt.Printf("Login on %s...\n", c.Url)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
parser.AddCommand("login",
|
||||||
|
"Initialize a connection to a piwigo instance",
|
||||||
|
"Initialize a connection to a piwigo instance",
|
||||||
|
&loginCommand)
|
||||||
|
}
|
27
main.go
Normal file
27
main.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/jessevdk/go-flags"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Options struct{}
|
||||||
|
|
||||||
|
var options Options
|
||||||
|
|
||||||
|
var parser = flags.NewParser(&options, flags.Default)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if _, err := parser.Parse(); err != nil {
|
||||||
|
switch flagsErr := err.(type) {
|
||||||
|
case flags.ErrorType:
|
||||||
|
if flagsErr == flags.ErrHelp {
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
os.Exit(1)
|
||||||
|
default:
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
tags.go
Normal file
22
tags.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type TagsCommand struct {
|
||||||
|
All bool `short:"a" long:"all" description:"Get all available tags"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var tagsCommand TagsCommand
|
||||||
|
|
||||||
|
func (c *TagsCommand) Execute(args []string) error {
|
||||||
|
fmt.Printf("List tags %v\n", c.All)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
parser.AddCommand("tags",
|
||||||
|
"List tags",
|
||||||
|
"List tags",
|
||||||
|
&tagsCommand)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user