replace pipe to less with bubbletea internal pager (#57)

This commit is contained in:
T.v.Dein
2025-08-26 10:22:03 +02:00
committed by GitHub
parent 5168b04339
commit f1c5ee5797
6 changed files with 168 additions and 28 deletions

View File

@@ -17,12 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"bytes"
"errors"
"fmt"
"log"
"os"
"os/exec"
"strings"
"github.com/spf13/cobra"
@@ -30,24 +27,6 @@ import (
"github.com/tlinden/tablizer/lib"
)
func man() {
man := exec.Command("less", "-")
var buffer bytes.Buffer
buffer.Write([]byte(manpage))
man.Stdout = os.Stdout
man.Stdin = &buffer
man.Stderr = os.Stderr
err := man.Run()
if err != nil {
log.Fatal(err)
}
}
func completion(cmd *cobra.Command, mode string) error {
switch mode {
case "bash":
@@ -94,7 +73,7 @@ func Execute() {
}
if ShowManual {
man()
Pager("tablizer manual page", manpage)
return
}