Documentation
¶
Overview ¶
Package transfer runs imports in the background and draws their progress: the mode indicator says WAIT, the context line offers Esc, the status line counts rows with a progress bar, and the terminal shows its own progress indicator. It remembers where the sheet came from, so Save can offer to export it back. What an import's result does to the workbook is the UI's; this package needs no host.
Index ¶
- func Rows(n int) string
- func Thousands(n int) string
- type ImportedMsg
- type Place
- type TickMsg
- type Transfer
- func (x *Transfer) Begin(name string, prog *fileio.Progress, cancel func(), place Place) int
- func (x *Transfer) Busy() bool
- func (x *Transfer) Cancel() string
- func (x *Transfer) Line(th *theme.Theme) string
- func (x *Transfer) ProgressBar() *tea.ProgressBar
- func (x *Transfer) Start(name, path string, opt fileio.Options, place Place, parent telemetry.Parent) tea.Cmd
- func (x *Transfer) StartReader(name string, r io.Reader, opt fileio.Options, parent telemetry.Parent) tea.Cmd
- func (x *Transfer) Status(th *theme.Theme, width int) (left, right string)
- func (x *Transfer) Update(msg tea.Msg) (res ImportedMsg, done bool, cmd tea.Cmd)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ImportedMsg ¶
type ImportedMsg struct {
ID int
Name string
Opt fileio.Options
Place Place
Res *fileio.Result
Err error
// Stream is set for a table read from a stream (StartReader), which
// has no file to save back to.
Stream bool
}
ImportedMsg is an import's result.
type TickMsg ¶
type TickMsg struct {
// contains filtered or unexported fields
}
TickMsg refreshes the progress display.
type Transfer ¶
type Transfer struct {
Source string // the file the sheet was imported from, if any
Kind fileio.Kind // its format
Startup string // a file to import as the program starts
// contains filtered or unexported fields
}
Transfer is the model's import state.
func (*Transfer) Begin ¶
Begin tracks an import of name reporting to prog, cancelled by cancel, replacing any import running, and returns its ID for its ImportedMsg.
func (*Transfer) Cancel ¶
Cancel stops the import at once and returns the name of its file; its result, if it still arrives, is ignored.
func (*Transfer) ProgressBar ¶
func (x *Transfer) ProgressBar() *tea.ProgressBar
ProgressBar is the terminal's own progress indicator (OSC 9;4), shown in the tab or title bar where supported.
func (*Transfer) Start ¶
func (x *Transfer) Start(name, path string, opt fileio.Options, place Place, parent telemetry.Parent) tea.Cmd
Start reads name, at path on disk, in the background, replacing any import running. Its span nests under parent.
func (*Transfer) StartReader ¶ added in v0.3.0
func (x *Transfer) StartReader(name string, r io.Reader, opt fileio.Options, parent telemetry.Parent) tea.Cmd
StartReader reads a table from r in the background, as Start reads a file, into a sheet called name: standard input, for 012 -. Its result is marked Stream.
func (*Transfer) Status ¶
Status is the status line during an import, width wide: the file, the rows read, and a bar when the total is known.