Skip to main content

Module add

Module add 

Source
Expand description

Logic for the timebomb plant subcommand.

This module implements the core logic for inserting a timebomb fuse into a source file at a specific line. It is intentionally defined with primitive parameters so that it compiles independently of any PlantArgs struct changes in cli.rs.

Functionsยง

build_annotation
Build the full annotation string.
detect_comment_style
Return the comment prefix appropriate for the given file extension.
find_matching_lines
Scan a file line-by-line and return all (1-based line number, line content) pairs where the line contains pattern as a substring (case-sensitive).
insert_line
Insert new_line before the 1-based line_number in lines, returning the complete new file content as a String.
parse_target
Parse "path/to/file.rs:42" into (PathBuf, usize).
resolve_date
Resolve the expiry NaiveDate from the --date or --in-days arguments.
run_add
Core logic for timebomb plant.