mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-17 12:31:06 +01:00
replace pipe to less with bubbletea internal pager (#57)
This commit is contained in:
23
cmd/root.go
23
cmd/root.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user