fix: output ls.

This commit is contained in:
Daniel Ding
2025-12-29 19:25:44 +08:00
parent 5f8fb5d217
commit 6a8da032ed
2 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
package v5
import (
"io/ioutil"
"os"
"strings"
"github.com/luscis/openlan/cmd/api"
@@ -12,7 +12,7 @@ func Before(c *cli.Context) error {
token := c.String("token")
if token == "" {
tokenFile := api.AdminTokenFile
if data, err := ioutil.ReadFile(tokenFile); err == nil {
if data, err := os.ReadFile(tokenFile); err == nil {
token = strings.TrimSpace(string(data))
}
_ = c.Set("token", token)
+4 -3
View File
@@ -78,8 +78,9 @@ func (o Output) List(c *cli.Context) error {
func (o Output) Commands() *cli.Command {
return &cli.Command{
Name: "output",
Usage: "Output links",
Name: "output",
Usage: "Output links",
Action: o.List,
Subcommands: []*cli.Command{
{
Name: "add",
@@ -88,7 +89,7 @@ func (o Output) Commands() *cli.Command {
&cli.StringFlag{Name: "remote", Required: true},
&cli.StringFlag{Name: "fallback"},
&cli.IntFlag{Name: "segment"},
&cli.StringFlag{Name: "protocol"},
&cli.StringFlag{Name: "protocol", Value: "vxlan"},
&cli.StringFlag{Name: "dstport"},
&cli.StringFlag{Name: "secret"},
&cli.StringFlag{Name: "crypt"},