mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-21 07:34:18 +02:00
Remove disabled force key/identity file stuff for now
This commit is contained in:
parent
45cde43dd4
commit
f8c4ddc388
2 changed files with 18 additions and 35 deletions
9
main.go
9
main.go
|
|
@ -177,9 +177,6 @@ func executeArg(cmd *cobra.Command, arg string, w io.Writer) error {
|
|||
return fmt.Errorf("error parsing config: %v", err)
|
||||
}
|
||||
|
||||
// Config from flags
|
||||
// cfg.IdentityFile = identityFile
|
||||
|
||||
// Log to file, if set
|
||||
if cfg.Logfile != "" {
|
||||
f, err := tea.LogToFile(cfg.Logfile, "glow")
|
||||
|
|
@ -295,12 +292,6 @@ func init() {
|
|||
rootCmd.Flags().StringVarP(&style, "style", "s", "auto", "style name or JSON path")
|
||||
rootCmd.Flags().UintVarP(&width, "width", "w", 0, "word-wrap at width")
|
||||
|
||||
// For network-related operations, namely stashing and the TUI
|
||||
/*
|
||||
rootCmd.PersistentFlags().StringVarP(&identityFile, "identity", "i", "", "path to identity file (that is, an ssh private key)")
|
||||
rootCmd.PersistentFlags().BoolVarP(&forceKey, "force-key", "f", false, "force the use of the SSH key on disk (that is, ignore ssh-agent)")
|
||||
*/
|
||||
|
||||
// Stash
|
||||
stashCmd.PersistentFlags().StringVarP(&memo, "memo", "m", "", "memo/note for stashing")
|
||||
rootCmd.AddCommand(stashCmd)
|
||||
|
|
|
|||
50
ui/ui.go
50
ui/ui.go
|
|
@ -32,8 +32,6 @@ var (
|
|||
|
||||
// Config contains configuration specified to the TUI.
|
||||
type Config struct {
|
||||
IdentityFile string
|
||||
|
||||
// For debugging the UI
|
||||
Logfile string `env:"GLOW_UI_LOGFILE"`
|
||||
HighPerformancePager bool `env:"GLOW_UI_HIGH_PERFORMANCE_PAGER" default:"true"`
|
||||
|
|
@ -170,7 +168,7 @@ func initialize(cfg Config, style string) func() (tea.Model, tea.Cmd) {
|
|||
|
||||
return m, tea.Batch(
|
||||
findLocalFiles,
|
||||
newCharmClient(&cfg.IdentityFile),
|
||||
newCharmClient,
|
||||
spinner.Tick(m.stash.spinner),
|
||||
)
|
||||
}
|
||||
|
|
@ -302,7 +300,7 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) {
|
|||
case keygenSuccessMsg:
|
||||
// The keygen's done, so let's try initializing the charm client again
|
||||
m.keygenState = keygenFinished
|
||||
cmds = append(cmds, newCharmClient(nil))
|
||||
cmds = append(cmds, newCharmClient)
|
||||
|
||||
case newCharmClientMsg:
|
||||
m.cc = msg
|
||||
|
|
@ -434,32 +432,26 @@ func findNextLocalFile(m model) tea.Cmd {
|
|||
}
|
||||
}
|
||||
|
||||
func newCharmClient(identityFile *string) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
cfg, err := charm.ConfigFromEnv()
|
||||
if err != nil {
|
||||
return errMsg{err}
|
||||
}
|
||||
|
||||
if identityFile != nil {
|
||||
cfg.SSHKeyPath = *identityFile
|
||||
}
|
||||
|
||||
cc, err := charm.NewClient(cfg)
|
||||
if err == charm.ErrMissingSSHAuth {
|
||||
if debug {
|
||||
log.Println("missing SSH auth:", err)
|
||||
}
|
||||
return sshAuthErrMsg{}
|
||||
} else if err != nil {
|
||||
if debug {
|
||||
log.Println("error creating new charm client:", err)
|
||||
}
|
||||
return errMsg{err}
|
||||
}
|
||||
|
||||
return newCharmClientMsg(cc)
|
||||
func newCharmClient() tea.Msg {
|
||||
cfg, err := charm.ConfigFromEnv()
|
||||
if err != nil {
|
||||
return errMsg{err}
|
||||
}
|
||||
|
||||
cc, err := charm.NewClient(cfg)
|
||||
if err == charm.ErrMissingSSHAuth {
|
||||
if debug {
|
||||
log.Println("missing SSH auth:", err)
|
||||
}
|
||||
return sshAuthErrMsg{}
|
||||
} else if err != nil {
|
||||
if debug {
|
||||
log.Println("error creating new charm client:", err)
|
||||
}
|
||||
return errMsg{err}
|
||||
}
|
||||
|
||||
return newCharmClientMsg(cc)
|
||||
}
|
||||
|
||||
func loadStash(m stashModel) tea.Cmd {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue