Skip to content

Conversation

@copydataai
Copy link

@copydataai copydataai commented Oct 24, 2023

Description

Add a callback function as a field to area_printer to be executed every time on area.Update

Scope

area_printer, interactive_select_printer

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Related Issue

Fixes #

To-Do Checklist

  • I tested my changes
  • I have commented on every method that I created/changed
  • I updated the examples to fit with my changes
  • I have added tests for my newly created methods

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1da850f) 82.00% compared to head (572b4e2) 82.04%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #579      +/-   ##
==========================================
+ Coverage   82.00%   82.04%   +0.04%     
==========================================
  Files          32       32              
  Lines        3623     3632       +9     
==========================================
+ Hits         2971     2980       +9     
  Misses        605      605              
  Partials       47       47              
Files Coverage Δ
area_printer.go 97.33% <ø> (+0.23%) ⬆️
interactive_select_printer.go 53.73% <ø> (+0.65%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@copydataai copydataai changed the title Adding callback to area_printer and interactive_select_printer Feature: add callback to area_printer and interactive_select_printer Oct 26, 2023
@chaopeng
Copy link

chaopeng commented Dec 8, 2023

Sorry for random commenting.

I like a feature like this so that I can build something like fzf preview.

Seems like owner prefer to use "copy" when "WithXXX()".

func (p InteractiveSelectPrinter) WithOnInterruptFunc(exitFunc func()) *InteractiveSelectPrinter {
	p.OnInterruptFunc = exitFunc
	return &p
}

Every "With" call with have a new Printer, callback func is hard to track which Printer is under callback. Maybe consider callback takes a interface (pointer of the Printer). Not sure how the owner want to impl this. Maybe we should let owner invok earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants