introduce pick-all

This commit is contained in:
2026-10-21 13:58:20 +01:00
parent b4e2b92104
commit 4a693a9a50
3 changed files with 51 additions and 2 deletions
+16 -1
View File
@@ -50,7 +50,11 @@ Examples:
dirmd -i
# Pick specific files in vertical slices mode
dirmd -o ./docs ~/repos/myproject --vertical-slices --pick common/src/lib.rs --pick mssql-extractor/src/processor.rs`,
dirmd -o ./docs ~/repos/myproject --vertical-slices \
--pick common/src/config.rs --pick init/src/main.rs
# Pick all files as individual picks
dirmd -o ./docs ~/repos/myproject --vertical-slices --pick-all`,
RunE: run,
}
@@ -72,6 +76,7 @@ Examples:
tuiMode bool
instructions bool
pickPaths []string
pickAll bool
)
func Execute() {
@@ -99,6 +104,7 @@ func init() {
rootCmd.Flags().BoolVar(&omitMd, "omit-md", false, "omit all .md files except README.md")
rootCmd.Flags().BoolVar(&instructions, "instructions", false, "include .dirmd instructions file if present in root")
rootCmd.Flags().StringArrayVar(&pickPaths, "pick", nil, "repeatable: relative path to file to include as pick (requires --vertical-slices)")
rootCmd.Flags().BoolVar(&pickAll, "pick-all", false, "include all discovered files as individual picks (requires --vertical-slices)")
}
func run(cmd *cobra.Command, args []string) error {
@@ -130,6 +136,14 @@ func run(cmd *cobra.Command, args []string) error {
return fmt.Errorf("--pick requires --vertical-slices")
}
if pickAll && !verticalSlices {
return fmt.Errorf("--pick-all requires --vertical-slices")
}
if pickAll && len(pickPaths) > 0 {
return fmt.Errorf("--pick-all and --pick cannot be used together")
}
excludedExts := append(config.DefaultExts, extensions...)
if skipFrontend {
excludedExts = append(excludedExts, config.FrontendExts...)
@@ -152,6 +166,7 @@ func run(cmd *cobra.Command, args []string) error {
OmitMd: omitMd,
IncludeInstructions: instructions,
PickPaths: pickPaths,
PickAll: pickAll,
}
if singleFile != "" {