[#3] Get Qutebrowser sessions
This commit is contained in:
parent
f0c98c5544
commit
a69342c27e
1 changed files with 5 additions and 4 deletions
9
main.go
9
main.go
|
@ -49,17 +49,18 @@ func getBrowserSessions() []sessionOrCommand {
|
|||
log.Printf("INFO userConfigDir: %+v", userConfigDir)
|
||||
fileSystem := os.DirFS(userConfigDir)
|
||||
log.Printf("INFO fileSystem: %+v", fileSystem)
|
||||
fileList, err := fs.ReadDir(fileSystem, "/qutebrowser/sessions")
|
||||
fileList, err := fs.ReadDir(fileSystem, "local/share/qutebrowser/sessions")
|
||||
if err != nil {
|
||||
log.Printf("Error reading browser sessions directory: %v", err)
|
||||
return []sessionOrCommand{}
|
||||
}
|
||||
// 2. Exclude non-YAML files
|
||||
// 3. Wrangle them into this struct array
|
||||
result := make([]sessionOrCommand, len(fileList))
|
||||
result := make([]sessionOrCommand, 0)
|
||||
for _, entry := range fileList {
|
||||
if !entry.IsDir() && strings.HasSuffix(entry.Name(), ".yml") {
|
||||
result = append(result, sessionOrCommand{displayString: entry.Name(), commandString: ""})
|
||||
log.Printf("INFO %s", entry.Name())
|
||||
result = append(result, sessionOrCommand{displayString: strings.TrimSuffix(entry.Name(), ".yml"), commandString: ""})
|
||||
}
|
||||
}
|
||||
// log.Printf("result: %v", result)
|
||||
|
@ -136,7 +137,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
}
|
||||
|
||||
func (m model) View() string {
|
||||
s := "What should we buy at the market?\n\n"
|
||||
s := "Let's get started!\n\n"
|
||||
|
||||
for j := 0; j < 2; j++ {
|
||||
for i, choice := range m.choices[j] {
|
||||
|
|
Loading…
Reference in a new issue