|
|
@@ -69,6 +69,11 @@ var debugCmd = &ffcli.Command{
|
|
|
Exec: runEnv,
|
|
|
ShortHelp: "print cmd/tailscale environment",
|
|
|
},
|
|
|
+ {
|
|
|
+ Name: "stat",
|
|
|
+ Exec: runStat,
|
|
|
+ ShortHelp: "stat a file",
|
|
|
+ },
|
|
|
{
|
|
|
Name: "hostinfo",
|
|
|
Exec: runHostinfo,
|
|
|
@@ -284,6 +289,28 @@ func runEnv(ctx context.Context, args []string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+func runStat(ctx context.Context, args []string) error {
|
|
|
+ for _, a := range args {
|
|
|
+ fi, err := os.Lstat(a)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Printf("%s: %v\n", a, err)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ fmt.Printf("%s: %v, %v\n", a, fi.Mode(), fi.Size())
|
|
|
+ if fi.IsDir() {
|
|
|
+ ents, _ := os.ReadDir(a)
|
|
|
+ for i, ent := range ents {
|
|
|
+ if i == 25 {
|
|
|
+ fmt.Printf(" ...\n")
|
|
|
+ break
|
|
|
+ }
|
|
|
+ fmt.Printf(" - %s\n", ent.Name())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
func runHostinfo(ctx context.Context, args []string) error {
|
|
|
hi := hostinfo.New()
|
|
|
j, _ := json.MarshalIndent(hi, "", " ")
|