MCPcopy Create free account
hub / github.com/Mister-leo/fssh / cmdList

Function cmdList

cmd/fssh/main.go:146–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144}
145
146func cmdList() {
147 dir := store.KeysDir()
148 entries, err := os.ReadDir(dir)
149 if err != nil && !os.IsNotExist(err) {
150 fatal(err)
151 }
152 if len(entries) == 0 {
153 fmt.Println("no keys imported")
154 return
155 }
156 for _, e := range entries {
157 if e.IsDir() || !strings.HasSuffix(e.Name(), ".enc") {
158 continue
159 }
160 p := filepath.Join(dir, e.Name())
161 data, err := os.ReadFile(p)
162 if err != nil {
163 fatal(err)
164 }
165 var m store.EncryptedFile
166 if err := json.Unmarshal(data, &m); err != nil {
167 fatal(err)
168 }
169 fmt.Printf("alias=%s fingerprint=%s created=%s\n", m.Alias, m.Fingerprint, m.CreatedAt)
170 }
171}
172
173func cmdExport() {
174 fs := flag.NewFlagSet("export", flag.ExitOnError)

Callers 1

mainFunction · 0.85

Calls 2

KeysDirFunction · 0.92
fatalFunction · 0.85

Tested by

no test coverage detected