automd icon indicating copy to clipboard operation
automd copied to clipboard

feat(file): add line args

Open HigherOrderLogic opened this issue 1 year ago โ€ข 2 comments
trafficstars

๐Ÿ”— Linked issue

N/A

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality like performance)
  • [x] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

Add line to limit the amount of content copy over.

Im not sure if their name fit. I'll add docs after the args' name are finalized.

๐Ÿ“ Checklist

  • [ ] I have linked an issue or discussion.
  • [ ] I have updated the documentation accordingly.

HigherOrderLogic avatar Mar 16 '24 13:03 HigherOrderLogic

Nice idea! How do you think to smplify to one lines arg:

  • lines=5:
  • lines=2:5
  • lines=:5

pi0 avatar Mar 16 '24 14:03 pi0

Nice idea! How do you think to smplify to one lines arg:

  • lines=5:
  • lines=2:5
  • lines=:5

Yeah I think that's nicer.

And in case only the starting/ending line was defined, should we assume that the user want to copy from line 0/to the end?

HigherOrderLogic avatar Mar 16 '24 14:03 HigherOrderLogic

Waiting on this change to adopt this library, any estimates of when this will be published?

Also from personal experience using a similar library on this project https://github.com/MionKit/mion. When importing source code, using line numbers gets very difficult to maintain and requires a review every time the src code gets updated. it would be very interesting to be able to use a pattern delimiter as an argument so we can insert comments in the src code and extract the code between the delimiters

<!-- automd:file src="./example.ts" code dlimiter="//######myFunction" -->
<!-- /automd -->

This would extract anything between the delimiter // ######myFunction

// file ./example.ts

export const token = '1';

// ######myFunction
export function myFunction() {
   // code here
}
// ######myFunction

This example would only import the src code within the delimiters (myFunction).

willing to work on it after this PR get merged

M-jerez avatar Oct 24 '24 14:10 M-jerez

@M-jerez nice idea feel free to make a PR to support pattern matches. (also see #78 which is relevant. ideally we could have similar matcher syntax of browsers)

pi0 avatar Feb 26 '25 12:02 pi0