wip: capitalisation, help help & remapping scroll

This commit is contained in:
2023-07-24 12:33:17 +02:00
parent d1ea920fbe
commit f46b0b2c44
4 changed files with 24 additions and 22 deletions

View File

@ -78,7 +78,7 @@ func connInit(m *model) tea.Msg {
return errMsg{Err: fmt.Errorf("unable to initialise torrc builder: %s", err)} return errMsg{Err: fmt.Errorf("unable to initialise torrc builder: %s", err)}
} }
m.sendStatus("initialising Tor ACN...") m.sendStatus("Initialising Tor ACN...")
acn, err := tor.NewTorACNWithAuth( acn, err := tor.NewTorACNWithAuth(
path.Join(m.userDir, "/.tor"), path.Join(m.userDir, "/.tor"),
@ -93,7 +93,7 @@ func connInit(m *model) tea.Msg {
return errMsg{Err: fmt.Errorf("unable to bootstrap tor: %s", err)} return errMsg{Err: fmt.Errorf("unable to bootstrap tor: %s", err)}
} }
m.sendStatus("waiting for Tor ACN to bootstrap...") m.sendStatus("Waiting for ACN to bootstrap...")
if err := acn.WaitTillBootstrapped(); err != nil { if err := acn.WaitTillBootstrapped(); err != nil {
return errMsg{Err: fmt.Errorf("unable to initialise tor: %s", err)} return errMsg{Err: fmt.Errorf("unable to initialise tor: %s", err)}
@ -111,7 +111,7 @@ func connInit(m *model) tea.Msg {
app := app.NewApp(acn, m.userDir, settingsFile) app := app.NewApp(acn, m.userDir, settingsFile)
app.InstallEngineHooks(connections.DefaultEngineHooks{}) app.InstallEngineHooks(connections.DefaultEngineHooks{})
m.sendStatus("the Tor ACN is up") m.sendStatus("Tor ACN is up and running, all engines go")
return appInitialisedMsg{ return appInitialisedMsg{
app: app, app: app,

View File

@ -6,14 +6,14 @@ import (
tea "github.com/charmbracelet/bubbletea" tea "github.com/charmbracelet/bubbletea"
) )
const cmdHelp = `/clear const cmdHelp = `/clear | Clear the screen
/connect /connect | Start the Tor ACN
/help /help | Show this help
/profile create <name> <password> <password> /profile create <name> <password> <password> | Create a new profile
/profile info /profile info | Show profile information
/profile unlock <password> /profile unlock <password> | Unlock profile(s)
/start /start | Show getting started guide
/quit` /quit | Quit the program`
func isHelpCmd(cmds []string) bool { func isHelpCmd(cmds []string) bool {
if cmds[0] == "help" { if cmds[0] == "help" {

View File

@ -24,11 +24,12 @@ const (
Metadata resistant messaging Metadata resistant messaging
Pre-alpha v0.1.0 Pre-alpha v0.1.0
Run /start for the getting started guide Run /start for the getting started guide.
Use the /help command to see the command listing` Run /help to see all available commands.`
gettingStartedMessage = ` gettingStartedMessage = `=====================
== Getting started guide == Getting started guide
=====================
Welcome to Cairde, a terminal client for metadata resistant messaging built on Welcome to Cairde, a terminal client for metadata resistant messaging built on
the Cwtch protocol. In order to get started, you'll need to connect to the Tor the Cwtch protocol. In order to get started, you'll need to connect to the Tor
@ -37,12 +38,13 @@ network, initialise Cwtch and create your first profile. It's simple!
1. Type /connect to start your Tor engines and initialise Cwtch. 1. Type /connect to start your Tor engines and initialise Cwtch.
2. Type "/profile create <name> <password> <password>" to create a profile. 2. Type "/profile create <name> <password> <password>" to create a profile.
Please replace <...> with your own name/passwords. Please replace <...> with your own name/passwords. Both passwords should
match. WARNING: if you can't remember your password, you can't unlock your
profile, so **write it down somehwere safe**.
TODO: TODO:
* how to invite contacts * how to invite contacts
* how to toggle contact via menu * how to toggle contact via menu`
`
) )
type model struct { type model struct {
@ -91,7 +93,7 @@ func newModel(username, homeDir string) model {
connState: offline, connState: offline,
menuBar: []string{"STATUS", "P1", "P2"}, menuBar: []string{"STATUS"},
menuState: 0, menuState: 0,
input: input, input: input,
@ -370,7 +372,7 @@ func (m model) View() string {
var renderedCmdHelp []string var renderedCmdHelp []string
cmdHelp := []string{ cmdHelp := []string{
"CTRL+N/P", "SWITCH PROFILE", "CTRL+N/P", "SWITCH PROFILE",
"CTRL+U/D", "SCROLL UP/DOWN", "CTRL+J/K", "SCROLL UP/DOWN",
"CTRL+L", "CLEAR", "CTRL+L", "CLEAR",
"CTRL+C", "EXIT", "CTRL+C", "EXIT",
} }

View File

@ -30,8 +30,8 @@ func newViewport(width, height int) viewport.Model {
viewp.KeyMap = viewport.KeyMap{ viewp.KeyMap = viewport.KeyMap{
PageDown: key.NewBinding(key.WithKeys("pgdown")), PageDown: key.NewBinding(key.WithKeys("pgdown")),
PageUp: key.NewBinding(key.WithKeys("pgup")), PageUp: key.NewBinding(key.WithKeys("pgup")),
HalfPageUp: key.NewBinding(key.WithKeys("ctrl+u")), HalfPageUp: key.NewBinding(key.WithKeys("ctrl+k")),
HalfPageDown: key.NewBinding(key.WithKeys("ctrl+d")), HalfPageDown: key.NewBinding(key.WithKeys("ctrl+j")),
} }
return viewp return viewp
} }