File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "syscall"
55 "time"
66
7- "github.com/wsshow/ gotty/server"
7+ "gotty/server"
88)
99
1010type Options struct {
Original file line number Diff line number Diff line change 1- module github.com/wsshow/ gotty
1+ module gotty
22
33go 1.23
44
Original file line number Diff line number Diff line change @@ -12,18 +12,21 @@ import (
1212
1313 cli "github.com/urfave/cli/v2"
1414
15- "github.com/wsshow/gotty/backend/localcommand"
16- "github.com/wsshow/gotty/pkg/homedir"
17- "github.com/wsshow/gotty/server"
18- "github.com/wsshow/gotty/utils"
19- "github.com/wsshow/gotty/version"
15+ "gotty/backend/localcommand"
16+
17+ "gotty/pkg/homedir"
18+
19+ "gotty/server"
20+ "gotty/utils"
21+ "gotty/version"
2022)
2123
2224func main () {
2325 app := cli .NewApp ()
2426 app .Name = "gotty"
25- app .Version = version .Get ().Version
27+ app .Version = fmt . Sprintf ( "%s (%s)" , version .Get ().Version , version . Get (). BuildTime )
2628 app .Usage = "Share your terminal as a web application"
29+ app .Authors = []* cli.Author {{Name : "wsshow" }}
2730 app .HideHelpCommand = true
2831 appOptions := & server.Options {}
2932
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import (
1515 "github.com/gorilla/websocket"
1616 "github.com/pkg/errors"
1717
18- "github.com/wsshow/ gotty/webtty"
18+ "gotty/webtty"
1919)
2020
2121func (server * Server ) generateHandleWS (ctx context.Context , cancel context.CancelFunc , counter * counter ) http.HandlerFunc {
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ import (
1919 "github.com/gorilla/websocket"
2020 "github.com/pkg/errors"
2121
22- "github.com/wsshow/ gotty/bindata"
23- "github.com/wsshow/ gotty/pkg/homedir"
24- "github.com/wsshow/ gotty/pkg/randomstring"
25- "github.com/wsshow/ gotty/webtty"
22+ "gotty/bindata"
23+ "gotty/pkg/homedir"
24+ "gotty/pkg/randomstring"
25+ "gotty/webtty"
2626)
2727
2828// Server provides a webtty HTTP endpoint.
Original file line number Diff line number Diff line change 11package server
22
33import (
4- "github.com/wsshow/ gotty/webtty"
4+ "gotty/webtty"
55)
66
77// Slave is webtty.Slave with some additional methods.
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ package utils
22
33import (
44 "fmt"
5- "github.com/fatih/structs"
65 "reflect"
76 "strconv"
7+
8+ "github.com/fatih/structs"
89)
910
1011func ApplyDefaultValues (struct_ interface {}) (err error ) {
@@ -15,16 +16,17 @@ func ApplyDefaultValues(struct_ interface{}) (err error) {
1516 if defaultValue == "" {
1617 continue
1718 }
18- var val interface {}
19+ var val any
1920 switch field .Kind () {
2021 case reflect .String :
2122 val = defaultValue
2223 case reflect .Bool :
23- if defaultValue == "true" {
24+ switch defaultValue {
25+ case "true" :
2426 val = true
25- } else if defaultValue == "false" {
27+ case "false" :
2628 val = false
27- } else {
29+ default :
2830 return fmt .Errorf ("invalid bool expression: %v, use true/false" , defaultValue )
2931 }
3032 case reflect .Int :
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import (
1010 "github.com/urfave/cli/v2"
1111 "github.com/yudai/hcl"
1212
13- "github.com/wsshow/ gotty/pkg/homedir"
13+ "gotty/pkg/homedir"
1414)
1515
1616func GenerateFlags (options ... interface {}) (flags []cli.Flag , mappings map [string ]string , err error ) {
You can’t perform that action at this time.
0 commit comments