code.vegaprotocol.io/vega@v0.79.0/cmd/vegawallet/commands/printer/interactive_unix.go (about)

     1  // Copyright (C) 2023 Gobalsky Labs Limited
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Affero General Public License as
     5  // published by the Free Software Foundation, either version 3 of the
     6  // License, or (at your option) any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU Affero General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Affero General Public License
    14  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15  
    16  //go:build !windows
    17  // +build !windows
    18  
    19  package printer
    20  
    21  import (
    22  	"io"
    23  
    24  	"github.com/muesli/termenv"
    25  )
    26  
    27  func NewInteractivePrinter(w io.Writer) *InteractivePrinter {
    28  	profile := termenv.EnvColorProfile()
    29  	return &InteractivePrinter{
    30  		writer:       w,
    31  		profile:      profile,
    32  		checkMark:    termenv.String("✓ ").Foreground(profile.Color("2")).String(),
    33  		questionMark: termenv.String("? ").Foreground(profile.Color("5")).String(),
    34  		crossMark:    termenv.String("✗ ").Foreground(profile.Color("1")).String(),
    35  		bangMark:     termenv.String("! "),
    36  		arrow:        termenv.String("➜ "),
    37  	}
    38  }