Skip to content

[Help with the code 🙇] : I need to cancel progress bar twice to get back to terminal. #1124

Closed Answered by akash-aman
akash-aman asked this question in Q&A
Discussion options

You must be logged in to vote

Got the issue, I messed up with context channel, forgot to check some blocking conditions.

correct code

package main

import (
	"context"
	"os"
	"os/signal"
	"reflect"
	"strings"
	"sync"
	"syscall"
	"time"

	"github.com/charmbracelet/bubbles/progress"
	tea "github.com/charmbracelet/bubbletea"
	"github.com/charmbracelet/lipgloss"
)

const (
	padding  = 2
	maxWidth = 80
)

var (
	helpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#626262")).Render
)

type (
	Progress struct {
		progressModel progress.Model
		percentChan   chan float64
		isComplete    float64
		context       context.Context
		cancel        context.CancelFunc
	}

	tickMsg time.Time
)

func NewProgress(ctx context.Context

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by akash-aman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant