chore: improve variable naming
This commit is contained in:
parent
5a2ca8f361
commit
b56ec069b9
1 changed files with 12 additions and 12 deletions
|
@ -221,7 +221,7 @@ func Run(cmd *cobra.Command, args []string) error {
|
|||
Foreground(lipgloss.Color("1")).BorderLeftForeground(lipgloss.Color("1"))
|
||||
programDelegate.Styles.SelectedDesc = programDelegate.Styles.SelectedTitle
|
||||
|
||||
m := model{
|
||||
initialModel := model{
|
||||
categoriesList: list.New(categories, categoryDelegate, 0, 0),
|
||||
categoriesKeys: categoryKeys,
|
||||
programsList: list.New([]list.Item{}, programDelegate, 0, 0),
|
||||
|
@ -229,42 +229,42 @@ func Run(cmd *cobra.Command, args []string) error {
|
|||
selectedCategory: false,
|
||||
}
|
||||
|
||||
m.categoriesList.Title = "the cherry.town program directory"
|
||||
m.categoriesList.Styles.Title = titleStyle
|
||||
m.categoriesList.AdditionalShortHelpKeys = func() []key.Binding {
|
||||
initialModel.categoriesList.Title = "the cherry.town program directory"
|
||||
initialModel.categoriesList.Styles.Title = titleStyle
|
||||
initialModel.categoriesList.AdditionalShortHelpKeys = func() []key.Binding {
|
||||
return []key.Binding{
|
||||
categoryKeys.selectKey,
|
||||
}
|
||||
}
|
||||
m.categoriesList.AdditionalFullHelpKeys = func() []key.Binding {
|
||||
initialModel.categoriesList.AdditionalFullHelpKeys = func() []key.Binding {
|
||||
return []key.Binding{
|
||||
categoryKeys.selectKey,
|
||||
}
|
||||
}
|
||||
|
||||
m.programsList.Styles.Title = categoryTitleStyle
|
||||
m.programsList.AdditionalShortHelpKeys = func() []key.Binding {
|
||||
initialModel.programsList.Styles.Title = categoryTitleStyle
|
||||
initialModel.programsList.AdditionalShortHelpKeys = func() []key.Binding {
|
||||
return []key.Binding{
|
||||
programKeys.exec,
|
||||
programKeys.back,
|
||||
}
|
||||
}
|
||||
m.programsList.AdditionalFullHelpKeys = func() []key.Binding {
|
||||
initialModel.programsList.AdditionalFullHelpKeys = func() []key.Binding {
|
||||
return []key.Binding{
|
||||
programKeys.exec,
|
||||
programKeys.back,
|
||||
}
|
||||
}
|
||||
|
||||
p := tea.NewProgram(m)
|
||||
mf, err := p.Run()
|
||||
p := tea.NewProgram(initialModel)
|
||||
finalModel, err := p.Run()
|
||||
if err != nil {
|
||||
fmt.Println("error: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if mf, ok := mf.(model); ok && mf.shouldExec != "" {
|
||||
execCmd := exec.Command(mf.shouldExec)
|
||||
if finalModel, ok := finalModel.(model); ok && finalModel.shouldExec != "" {
|
||||
execCmd := exec.Command(finalModel.shouldExec)
|
||||
execCmd.Stdin = os.Stdin
|
||||
execCmd.Stdout = os.Stdout
|
||||
execCmd.Stderr = os.Stderr
|
||||
|
|
Loading…
Add table
Reference in a new issue