-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description This PR adds a new option to preserve the position of the generated block if the user so desires. this is helpful when there's certain strict order the developer wants to keep. Normally because there are manual entries. This closes #343 Missing: - [x] CLI option - [x] Documentation - [x] Logic Refactor (because it looks ugly what I did) Extra: So I was playing with ChatGPT, and I decided to ask for rewrites on my code the changes are not that bad. So I left them in
- Loading branch information
Showing
9 changed files
with
157 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { stripIndents } from 'common-tags'; | ||
import { CONTENT_MARK } from './constants'; | ||
|
||
const getContentLegend = (customRegenerationCommand?: string) => stripIndents` | ||
# This block has been generated with codeowners-generator (for more information https://github.com/gagoar/codeowners-generator) | ||
# ${ | ||
customRegenerationCommand ? `To re-generate, run \`${customRegenerationCommand}\`. ` : '' | ||
}Don't worry, the content outside this block will be kept. | ||
`; | ||
|
||
export const generatedContentTemplate = (generatedContent: string, customRegenerationCommand?: string) => { | ||
return stripIndents` | ||
${CONTENT_MARK} | ||
${getContentLegend(customRegenerationCommand)}\n | ||
${generatedContent}\n | ||
${CONTENT_MARK}\n | ||
`; | ||
}; | ||
export const rulesBlockTemplate = (source: string, entries: string[]): string => { | ||
return stripIndents` | ||
# Rule${entries.length > 1 ? 's' : ''} extracted from ${source} | ||
${entries.join('\n')} | ||
`; | ||
}; |