Skip to content

feat: tasklog groups #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

feat: tasklog groups #347

wants to merge 13 commits into from

Conversation

43081j
Copy link
Collaborator

@43081j 43081j commented Jun 19, 2025

This allows you to have tasklog groups.

Basically this:

const log = p.taskLog({
	title: 'yes?',
	limit: 5,
});

const group0 = log.group('group 0');
const group1 = log.group('group 1');

await Promise.all([
	(async () => {
		for (let i = 0; i < 10; i++) {
			group0.message(`foo ${i} bar`);
			await new Promise((r) => {
				setTimeout(r, 1000);
			});
		}
		group0.success('group 0 done!');
	})(),
	(async () => {
		for (let i = 0; i < 10; i++) {
			group1.message(`foo ${i} bar`);
			await new Promise((r) => {
				setTimeout(r, 500);
			});
		}
		group1.success('group 1 done!');
	})(),
]);

await new Promise((r) => {
	setTimeout(r, 1000);
});
log.success('yes!');

this will result in a scrolling task log whose sub-logs have a limit: 5 (i.e. the overall log has no such limit)

once inner logs complete, they collapse as normal

once the overall log completes, we collapse the entire thing and output the log if specified

cc @yannbf

Copy link

changeset-bot bot commented Jun 19, 2025

🦋 Changeset detected

Latest commit: 569faa6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Jun 19, 2025

@example/basic@example/changesets

npm i https://pkg.pr.new/bombshell-dev/clack/@clack/core@347
npm i https://pkg.pr.new/bombshell-dev/clack/@clack/prompts@347

commit: 569faa6

@43081j
Copy link
Collaborator Author

43081j commented Jul 3, 2025

@yannbf if you get chance, can you have a play around with this via the pkg-pr-new install?

im pretty happy with it so we just need to throw it around a bit and see if it falls over anywhere

Copy link
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good, just wondering if you're gonna add some tests in the future? 😁

also can you add a changeset please? 🙏🏻

@43081j
Copy link
Collaborator Author

43081j commented Jul 3, 2025

100% - i got side tracked and ended up working on some other stuff

ill try find some time to get back to this and add the tests etc

@43081j
Copy link
Collaborator Author

43081j commented Jul 6, 2025

tests + changeset added 👍

Copy link
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you James 🫡

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