Issue 23: Added progress indicators and cancellation (#34)
- Wrapped all table operations in a new foreground job context, which mediates foreground tasks. - Added cancellation support and partial results for table read operations. - Added the "mark" command, which can mark, unmark & toggle marked items - Added support for alias arguments. - Removed the "unmark" command, and replaced it as an alias to the "marked" command - Fixed seg faults raised when there is no table shown in the result set.
This commit is contained in:
parent
982d3a9ca7
commit
79692302af
29 changed files with 609 additions and 170 deletions
|
|
@ -57,14 +57,20 @@ func (c *CommandController) execute(ctx ExecContext, commandInput string) tea.Ms
|
|||
return command(ctx, tokens[1:])
|
||||
}
|
||||
|
||||
func (c *CommandController) Alias(commandName string) Command {
|
||||
func (c *CommandController) Alias(commandName string, aliasArgs []string) Command {
|
||||
return func(ctx ExecContext, args []string) tea.Msg {
|
||||
command := c.lookupCommand(commandName)
|
||||
if command == nil {
|
||||
return events.Error(errors.New("no such command: " + commandName))
|
||||
}
|
||||
|
||||
return command(ctx, args)
|
||||
var allArgs []string
|
||||
if len(aliasArgs) > 0 {
|
||||
allArgs = append(append([]string{}, aliasArgs...), args...)
|
||||
} else {
|
||||
allArgs = args
|
||||
}
|
||||
return command(ctx, allArgs)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,13 @@ func PromptForInput(prompt string, onDone func(value string) tea.Msg) tea.Msg {
|
|||
}
|
||||
}
|
||||
|
||||
func Confirm(prompt string, onYes func() tea.Msg) tea.Msg {
|
||||
func Confirm(prompt string, onResult func(yes bool) tea.Msg) tea.Msg {
|
||||
return PromptForInput(prompt, func(value string) tea.Msg {
|
||||
return onResult(value == "y")
|
||||
})
|
||||
}
|
||||
|
||||
func ConfirmYes(prompt string, onYes func() tea.Msg) tea.Msg {
|
||||
return PromptForInput(prompt, func(value string) tea.Msg {
|
||||
if value == "y" {
|
||||
return onYes()
|
||||
|
|
|
|||
6
internal/common/ui/events/jobs.go
Normal file
6
internal/common/ui/events/jobs.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
package events
|
||||
|
||||
type ForegroundJobUpdate struct {
|
||||
JobRunning bool
|
||||
JobStatus string
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue