diff options
| author | A Farzat <a@farzat.xyz> | 2026-06-20 16:58:01 +0300 |
|---|---|---|
| committer | A Farzat <a@farzat.xyz> | 2026-06-20 19:45:59 +0300 |
| commit | f54df9fd6d50030beee064bfd1415bad066107d2 (patch) | |
| tree | 0d2a2eb67045dc76bdb281945d41d919cc22802b /src/run.rs | |
| parent | 4ec209d3863e913cffbe8c6e0a14a292820a2715 (diff) | |
| download | repo2markdown-f54df9fd6d50030beee064bfd1415bad066107d2.tar.gz repo2markdown-f54df9fd6d50030beee064bfd1415bad066107d2.zip | |
Extract paths_from_null_separated_bytes to utils
Diffstat (limited to 'src/run.rs')
| -rw-r--r-- | src/run.rs | 15 |
1 files changed, 3 insertions, 12 deletions
@@ -1,13 +1,8 @@ -use std::{ - ffi::OsStr, - io::{Read, Write}, - os::unix::ffi::OsStrExt, - path::Path, -}; +use std::io::{Read, Write}; use repo2markdown::{ fenced_md_generator::generate_fenced_markdown, logger::Logger, - md_generator::generate_markdown_from_paths, + md_generator::generate_markdown_from_paths, path_list::paths_from_null_separated_bytes, }; use crate::cli::Cli; @@ -21,11 +16,7 @@ pub fn run<R: Read, W: Write>( let mut input_buf = Vec::new(); input.read_to_end(&mut input_buf)?; - let paths: Vec<&Path> = input_buf - .split(|b| *b == 0) - .filter(|bytes| !bytes.is_empty()) - .map(|bytes| Path::new(OsStr::from_bytes(bytes))) - .collect(); + let paths = paths_from_null_separated_bytes(&input_buf); if cli.fenced { generate_fenced_markdown( |
