Skip to content
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

Include Original Line Numbers #70

Closed
AbstractAlao opened this issue Dec 12, 2021 · 1 comment
Closed

Include Original Line Numbers #70

AbstractAlao opened this issue Dec 12, 2021 · 1 comment

Comments

@AbstractAlao
Copy link

I just want to osay thank you for this. I was able to automate taking screen shots of over 500+ lines of code. The only problem is that the line numbers options won't put the actual line numbers from the file unless you take a full screenshot of the code. When using the start line and end line option is there a way to show the start and stop line number in the screenshot?

@mixn mixn mentioned this issue Feb 6, 2023
26 tasks
@mixn
Copy link
Owner

mixn commented May 12, 2023

This feature ships with the official v2 release. 🙂

It will respect the --start value and set it as the first line number when line numbers are enabled.

Assuming this code in a file read-file-async.util.ts :

import { readFile } from 'node:fs/promises';

export default async (
  file: string,
  shouldEncode: boolean = true
): Promise<Buffer | string> =>
  await readFile(file, { encoding: shouldEncode ? 'utf8' : null });

Running

carbon-now read-file-async.util.ts --start 3

will lead to the expected result. 🙂

read-file-async util-6w4jmX8XgW

There is also a new config setting firstLineNumber that can be manually set inside a given preset. Please also note that lineNumbers has to be true for whatever preset you’re using.

--start will also always overwrite firstLineNumber, as expected.

Happy testing and using! 🥳

@mixn mixn closed this as completed May 12, 2023
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

No branches or pull requests

2 participants