Update go-writefreely to v1.4.0
As it was a breaking change, all the code using it has been modified accordingly. That also means less lines of code for doing the same thing, too. Signed-off-by: Shin'ya Minazuki <shinyoukai@laidback.moe>
This commit is contained in:
@@ -28,9 +28,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DoDelete(id string, args []string) {
|
func DoDelete(id string, args []string) {
|
||||||
writefreely.InstanceURL = Config.Host
|
c := writefreely.NewClient(Config.Host)
|
||||||
|
|
||||||
c := writefreely.NewClient()
|
|
||||||
c.SetToken(Config.Token)
|
c.SetToken(Config.Token)
|
||||||
|
|
||||||
err := c.DeletePost(&writefreely.PostParams{
|
err := c.DeletePost(&writefreely.PostParams{
|
||||||
|
|||||||
3
go.mod
3
go.mod
@@ -3,7 +3,7 @@ module code.laidback.moe/yuki
|
|||||||
go 1.25.2
|
go 1.25.2
|
||||||
|
|
||||||
require (
|
require (
|
||||||
code.laidback.moe/go-writefreely v1.3.2
|
code.laidback.moe/go-writefreely v1.4.0
|
||||||
github.com/spf13/cobra v1.10.2
|
github.com/spf13/cobra v1.10.2
|
||||||
github.com/tj/go-editor v1.0.0
|
github.com/tj/go-editor v1.0.0
|
||||||
golang.org/x/term v0.39.0
|
golang.org/x/term v0.39.0
|
||||||
@@ -11,7 +11,6 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
code.as/core/socks v1.0.0 // indirect
|
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/pkg/errors v0.8.1 // indirect
|
github.com/pkg/errors v0.8.1 // indirect
|
||||||
github.com/spf13/pflag v1.0.9 // indirect
|
github.com/spf13/pflag v1.0.9 // indirect
|
||||||
|
|||||||
6
go.sum
6
go.sum
@@ -1,7 +1,5 @@
|
|||||||
code.as/core/socks v1.0.0 h1:SPQXNp4SbEwjOAP9VzUahLHak8SDqy5n+9cm9tpjZOs=
|
code.laidback.moe/go-writefreely v1.4.0 h1:4CAdwtwJwThx4Twd0AFL9whhiaeBZ1CJyjaJna7o9Vk=
|
||||||
code.as/core/socks v1.0.0/go.mod h1:BAXBy5O9s2gmw6UxLqNJcVbWY7C/UPs+801CcSsfWOY=
|
code.laidback.moe/go-writefreely v1.4.0/go.mod h1:bUe8yGQYpUIR8cMAthkTQSRCDIILTuNUhUxcOxbV1zs=
|
||||||
code.laidback.moe/go-writefreely v1.3.2 h1:NXB81Vfs6Iklc659p6iwPNJD6kdRpCHUgxCTNF4T1B0=
|
|
||||||
code.laidback.moe/go-writefreely v1.3.2/go.mod h1:wt1ofi/PFoZ/rFFY08wfGRf8WROEpFxc1ueMgzMlrL8=
|
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
|||||||
3
login.go
3
login.go
@@ -30,9 +30,8 @@ func init() {
|
|||||||
// and authenticates to the instance.
|
// and authenticates to the instance.
|
||||||
func DoLogin(args []string) {
|
func DoLogin(args []string) {
|
||||||
var user, pass string
|
var user, pass string
|
||||||
writefreely.InstanceURL = Config.Host
|
|
||||||
|
|
||||||
c := writefreely.NewClient()
|
c := writefreely.NewClient(Config.Host)
|
||||||
|
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DoLogout(args []string) {
|
func DoLogout(args []string) {
|
||||||
writefreely.InstanceURL = Config.Host
|
c := writefreely.NewClient(Config.Host)
|
||||||
|
|
||||||
c := writefreely.NewClient()
|
|
||||||
c.SetToken(Config.Token)
|
c.SetToken(Config.Token)
|
||||||
|
|
||||||
err := c.Logout()
|
err := c.Logout()
|
||||||
|
|||||||
3
post.go
3
post.go
@@ -50,7 +50,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DoPost(collection, font, lang string, rtl bool, title string, args []string) {
|
func DoPost(collection, font, lang string, rtl bool, title string, args []string) {
|
||||||
writefreely.InstanceURL = Config.Host
|
|
||||||
var err error
|
var err error
|
||||||
var w *writefreely.Post
|
var w *writefreely.Post
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ func DoPost(collection, font, lang string, rtl bool, title string, args []string
|
|||||||
|
|
||||||
post := string(data)
|
post := string(data)
|
||||||
|
|
||||||
c := writefreely.NewClient()
|
c := writefreely.NewClient(Config.Host)
|
||||||
c.SetToken(Config.Token)
|
c.SetToken(Config.Token)
|
||||||
|
|
||||||
if len(collection) == 0 {
|
if len(collection) == 0 {
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DoUpdate(id, collection, font, lang string, rtl bool, title string, args []string) {
|
func DoUpdate(id, collection, font, lang string, rtl bool, title string, args []string) {
|
||||||
writefreely.InstanceURL = Config.Host
|
|
||||||
var err error
|
var err error
|
||||||
var w *writefreely.Post
|
var w *writefreely.Post
|
||||||
|
|
||||||
@@ -70,7 +69,7 @@ func DoUpdate(id, collection, font, lang string, rtl bool, title string, args []
|
|||||||
|
|
||||||
post := string(data)
|
post := string(data)
|
||||||
|
|
||||||
c := writefreely.NewClient()
|
c := writefreely.NewClient(Config.Host)
|
||||||
c.SetToken(Config.Token)
|
c.SetToken(Config.Token)
|
||||||
|
|
||||||
if len(collection) == 0 {
|
if len(collection) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user