- Notifications
You must be signed in to change notification settings - Fork1
OpenStreetMap but as terminal user interface (TUI) program
License
NotificationsYou must be signed in to change notification settings
mrusme/mercator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
OpenStreetMap but as terminal user interface (TUI) program andBubbleTea Bubble.
$ go get$ go build.
The binary is calledmercator
mercator
accepts latitude and longitude as arguments, e.g.:
$ mercator 25.0782266 -77.3383438
It also accepts a location name or address, e.g.:
$ mercator miami
mercator
accepts the-style
flag with an integer value representing one ofthe optionslisted asStyle
,e.g.:
$ mercator -style 4 new york
arrow up
/k
: Move northarrow right
/l
: Move eastarrow down
/j
: Move southarrow left
/h
: Move west-
/_
: Zoom out+
/=
: Zoom in
You can embed themapview
into your Bubble Tea application:
package mainimport ( tea"github.com/charmbracelet/bubbletea""github.com/mrusme/mercator/mapview")typemodelstruct {mv mapview.Model}funcmain() {m:=NewModel()m.mv.SetLocation("jamaica",15)p:=tea.NewProgram(m,tea.WithAltScreen())if_,err:=p.Run();err!=nil {panic(err) }}funcNewModel()model {m:=model{}m.mv=mapview.New(80,24)returnm}func (mmodel)Init() tea.Cmd {returntea.Batch(tea.EnterAltScreen)}func (mmodel)Update(msg tea.Msg) (tea.Model, tea.Cmd) {switchmt:=msg.(type) {case tea.KeyMsg:switchmt.String() {case"q","esc","ctrl+c":returnm,tea.Quit }case tea.WindowSizeMsg:m.mv.Width=mt.Widthm.mv.Height=mt.Heightreturnm,nil }varcmd tea.Cmdm.mv,cmd=m.mv.Update(msg)returnm,cmd}func (mmodel)View()string {returnm.mv.View()}
About
OpenStreetMap but as terminal user interface (TUI) program