conemu_progressbar_go

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 1 Imported by: 0

README

conemu-progressbar for Go

Simple Go library for using ConEmu ProgressBar sequences (`OSC 9;4`)

Installing

Run this:

$ go get github.com/ankddev/conemu-progressbar-go

Then, import in your code:

import "github.com/ankddev/conemu-progressbar-go"

And enjoy!

Documentation

Functions:

  • ClearProgress clears progress via sending sequence with 0 state
ClearProgress()
  • SetIndeterminateProgress sets indeterminate progress state
SetIndeterminateProgress()
  • SetProgress sets progress with default state
err := SetProgress(80)
if err != nil {
    fmt.Println(err.Error())
}

Returns error if progress < 0 or > 100

  • SetErrorProgress sets progress with error state
err := SetErrorProgress(50)
if err != nil {
    fmt.Println(err.Error())
}

Returns error if progress < 0 or > 100

  • SetWarningProgress sets progress with warning state
err := SetWarningProgress(0)
if err != nil {
    fmt.Println(err.Error())
}

Returns error if progress < 0 or > 100

Contributing

  • Fork repository
  • Clone your fork
  • Create changes
  • Run tests with
$ go test
  • Commit and push changes
  • Create pull request

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearProgress

func ClearProgress()

ClearProgress clears progress via sending sequence with 0 state

Example

Example for clearing progress

ClearProgress()
Output:

�]9;4;0;�\

func SetErrorProgress

func SetErrorProgress(progress int) error

SetErrorProgress sets progress with error state * progress is a number between 0 and 100, returns error if number isn't in this range

Example

Example for setting progress with error status successfully

err := SetErrorProgress(20)
if err != nil {
	return
}
Output:

�]9;4;2;20�\

func SetIndeterminateProgress

func SetIndeterminateProgress()

SetIndeterminateProgress sets indeterminate progress state

Example

Example for setting progress to indeterminate

SetIndeterminateProgress()
Output:

�]9;4;3;�\

func SetProgress

func SetProgress(progress int) error

SetProgress sets progress with default state * progress is a number between 0 and 100, returns error if number isn't in this range

Example

Example for setting progress successfully

err := SetProgress(80)
if err != nil {
	return
}
Output:

�]9;4;1;80�\

func SetWarningProgress

func SetWarningProgress(progress int) error

SetWarningProgress sets progress with warning state * progress is a number between 0 and 100, returns error if number isn't in this range

Example

Example for setting progress with warning status successfully

err := SetWarningProgress(30)
if err != nil {
	return
}
Output:

�]9;4;4;30�\

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL