-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package kultq | ||
|
||
import ( | ||
"errors" | ||
"io" | ||
"os" | ||
"os/exec" | ||
|
||
"github.com/abiosoft/ishell/v2" | ||
) | ||
|
||
func (e *Engine) startUI(c *ishell.Context, slip []statPair) error { | ||
printCode := func(path string) error { | ||
bat := exec.Command(e.cfg.Batcat, "--pager", "cat", path) //nolint:gosec // this is the way | ||
bat.Stdout = os.Stdout | ||
|
||
return bat.Run() | ||
} | ||
|
||
for _, s := range slip { | ||
if err := printCode(s.path1); err != nil { | ||
return err | ||
} | ||
if err := printCode(s.path2); err != nil { | ||
return err | ||
} | ||
c.Println("Score (%):", s.score*100) //nolint:mnd //percents | ||
yn, err := confirm(c, "Kill this guys (Ctrl+D to stop)?") | ||
if errors.Is(err, io.EOF) { | ||
return nil | ||
} | ||
if err != nil { | ||
return err | ||
} | ||
if yn { | ||
c.Println("KILLED") // TODO: implement | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters