Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

OpenStreetMap but as terminal user interface (TUI) program

License

NotificationsYou must be signed in to change notification settings

mrusme/mercator

Repository files navigation

mercator

OpenStreetMap but as terminal user interface (TUI) program andBubbleTea Bubble.

Build

$ go get$ go build.

The binary is calledmercator

Usage

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

Style

mercator accepts the-style flag with an integer value representing one ofthe optionslisted asStyle,e.g.:

$ mercator -style 4 new york

Navigation

  • arrow up/k: Move north
  • arrow right/l: Move east
  • arrow down/j: Move south
  • arrow left/h: Move west
  • -/_: Zoom out
  • +/=: Zoom in

Bubble

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()}

[8]ページ先頭

©2009-2025 Movatter.jp