Skip to content

Commit

Permalink
prevent panic on unknown terminal at stdout when rendering help
Browse files Browse the repository at this point in the history
  • Loading branch information
unRob committed Jul 18, 2022
1 parent 36960e8 commit f2de8ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .milpa/commands/itself/command-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@

set -o pipefail

@milpa.log info "looking for commands with prefix <$MILPA_ARG_PREFIX>"
if [[ "$MILPA_ARG_PREFIX" ]]; then
@milpa.log info "looking for commands with prefix <$MILPA_ARG_PREFIX>"
else
@milpa.log info "looking for all known commands"
fi

function get_tree () {
"$MILPA_COMPA" __inspect \
Expand Down
4 changes: 3 additions & 1 deletion internal/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"os"

"github.com/charmbracelet/glamour"
"github.com/sirupsen/logrus"
_c "github.com/unrob/milpa/internal/constants"
"github.com/unrob/milpa/internal/runtime"
"golang.org/x/term"
Expand All @@ -35,7 +36,8 @@ func Markdown(content []byte, withColor bool) ([]byte, error) {

width, _, err := term.GetSize(0)
if err != nil {
return content, err
logrus.Debugf("Could not get terminal width")
width = 80
}

var styleFunc glamour.TermRendererOption
Expand Down

0 comments on commit f2de8ce

Please sign in to comment.