-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add debug Signed-off-by: ysicing <i@ysicing.me>
- Loading branch information
Showing
12 changed files
with
146 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2023 ysicing(ysicing.me, ysicing@ysicing.cloud) All rights reserved. | ||
// Use of this source code is covered by the following dual licenses: | ||
// (1) Y PUBLIC LICENSE 1.0 (YPL 1.0) | ||
// (2) Affero General Public License 3.0 (AGPL 3.0) | ||
// License that can be found in the LICENSE file. | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/ysicing/tiga/cmd/debug" | ||
"github.com/ysicing/tiga/pkg/factory" | ||
) | ||
|
||
func newCmdDebug(f factory.Factory) *cobra.Command { | ||
debugCmd := &cobra.Command{ | ||
Use: "debug", | ||
Short: "debug, not a stable interface, contains misc debug facilities", | ||
Long: fmt.Sprintf("\"%s debug\" contains misc debug facilities; it is not a stable interface.", os.Args[0]), | ||
} | ||
debugCmd.AddCommand(debug.HostInfoCommand(f)) | ||
return debugCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2023 ysicing(ysicing.me, ysicing@ysicing.cloud) All rights reserved. | ||
// Use of this source code is covered by the following dual licenses: | ||
// (1) Y PUBLIC LICENSE 1.0 (YPL 1.0) | ||
// (2) Affero General Public License 3.0 (AGPL 3.0) | ||
// License that can be found in the LICENSE file. | ||
|
||
package debug | ||
|
||
import ( | ||
"encoding/json" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/ysicing/tiga/internal/pkg/hostinfo" | ||
"github.com/ysicing/tiga/pkg/factory" | ||
) | ||
|
||
func HostInfoCommand(f factory.Factory) *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "hostinfo", | ||
Short: "print hostinfo", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
hi := hostinfo.New() | ||
j, _ := json.MarshalIndent(hi, "", " ") | ||
os.Stdout.Write(j) | ||
return nil | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
## tiga debug | ||
|
||
debug, not a stable interface, contains misc debug facilities | ||
|
||
### Synopsis | ||
|
||
"/var/folders/59/glr2j03s3ws0bhb_v3zxt5lr0000gn/T/go-build3580675129/b001/exe/docs debug" contains misc debug facilities; it is not a stable interface. | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for debug | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
--config string The tiga config file to use (default "/Users/ysicing/.config/tiga/config/default.yaml") | ||
--debug Prints the stack trace if an error occurs | ||
--silent Run in silent mode and prevents any tiga log output except panics & fatals | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [tiga](tiga.md) - tiga is a cli tool for senior restart engineer | ||
* [tiga debug hostinfo](tiga_debug_hostinfo.md) - print hostinfo | ||
|
||
###### Auto generated by spf13/cobra on 8-May-2023 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## tiga debug hostinfo | ||
|
||
print hostinfo | ||
|
||
``` | ||
tiga debug hostinfo [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for hostinfo | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
--config string The tiga config file to use (default "/Users/ysicing/.config/tiga/config/default.yaml") | ||
--debug Prints the stack trace if an error occurs | ||
--silent Run in silent mode and prevents any tiga log output except panics & fatals | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [tiga debug](tiga_debug.md) - debug, not a stable interface, contains misc debug facilities | ||
|
||
###### Auto generated by spf13/cobra on 8-May-2023 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2023 ysicing(ysicing.me, ysicing@ysicing.cloud) All rights reserved. | ||
// Use of this source code is covered by the following dual licenses: | ||
// (1) Y PUBLIC LICENSE 1.0 (YPL 1.0) | ||
// (2) Affero General Public License 3.0 (AGPL 3.0) | ||
// License that can be found in the LICENSE file. | ||
|
||
package hostinfo | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ysicing/tiga/common" | ||
hinfo "tailscale.com/hostinfo" | ||
"tailscale.com/tailcfg" | ||
) | ||
|
||
// New returns a partially populated Hostinfo for the current host. | ||
func New() *tailcfg.Hostinfo { | ||
t := hinfo.New() | ||
t.IPNVersion = fmt.Sprintf("%s-%s", common.Version, common.GitCommitHash) | ||
return t | ||
} |