@@ -55,9 +55,9 @@ fn enter_recursive_dir_entries(
5555 . unwrap_or_else ( || path_to_string ( root) . into ( ) )
5656 . trim_end_matches ( '/' )
5757 . to_string ( ) ;
58- write ! (
58+ writeln ! (
5959 err,
60- "writing top-level directory entry for {base_dirname:?}\n "
60+ "writing top-level directory entry for {base_dirname:?}"
6161 ) ?;
6262 writer. add_directory ( & base_dirname, options) ?;
6363
@@ -78,29 +78,26 @@ fn enter_recursive_dir_entries(
7878 let file_type = dir_entry. file_type ( ) ?;
7979 if file_type. is_symlink ( ) {
8080 let target: String = path_to_string ( fs:: read_link ( dir_entry. path ( ) ) ?) . into ( ) ;
81- write ! (
81+ writeln ! (
8282 err,
83- "writing recursive symlink entry with name {full_path:?} and target {target:?}\n "
83+ "writing recursive symlink entry with name {full_path:?} and target {target:?}"
8484 ) ?;
8585 writer. add_symlink ( full_path, target, options) ?;
8686 } else if file_type. is_file ( ) {
87- write ! (
88- err,
89- "writing recursive file entry with name {full_path:?}\n "
90- ) ?;
87+ writeln ! ( err, "writing recursive file entry with name {full_path:?}" ) ?;
9188 writer. start_file ( full_path, options) ?;
9289 let mut f = fs:: File :: open ( dir_entry. path ( ) ) ?;
9390 io:: copy ( & mut f, writer) ?;
9491 } else {
9592 assert ! ( file_type. is_dir( ) ) ;
96- write ! (
93+ writeln ! (
9794 err,
98- "writing recursive directory entry with name {full_path:?}\n "
95+ "writing recursive directory entry with name {full_path:?}"
9996 ) ?;
10097 writer. add_directory ( full_path, options) ?;
101- write ! (
98+ writeln ! (
10299 err,
103- "adding subdirectories depth-first for recursive directory entry {entry_basename:?}\n "
100+ "adding subdirectories depth-first for recursive directory entry {entry_basename:?}"
104101 ) ?;
105102 let new_readdir = fs:: read_dir ( dir_entry. path ( ) ) ?;
106103 readdir_stack. push ( ( new_readdir, entry_basename) ) ;
@@ -123,13 +120,13 @@ pub fn execute_compress(
123120
124121 let out = match output_path {
125122 Some ( path) => {
126- write ! ( err, "writing compressed zip to output file path {path:?}\n " ) ?;
123+ writeln ! ( err, "writing compressed zip to output file path {path:?}" ) ?;
127124 OutputHandle :: File ( fs:: File :: create ( path) ?)
128125 }
129126 None => {
130- write ! (
127+ writeln ! (
131128 err,
132- "writing to stdout and buffering compressed zip in memory\n "
129+ "writing to stdout and buffering compressed zip in memory"
133130 ) ?;
134131 if io:: stdout ( ) . is_terminal ( ) && !allow_stdout {
135132 return Err ( eyre ! ( "stdout is a tty, but --stdout was not set" ) ) ;
@@ -142,7 +139,7 @@ pub fn execute_compress(
142139 let mut options = SimpleFileOptions :: default ( )
143140 . compression_method ( CompressionMethod :: Deflated )
144141 . large_file ( false ) ;
145- write ! ( err, "default zip entry options: {options:?}\n " ) ?;
142+ writeln ! ( err, "default zip entry options: {options:?}" ) ?;
146143 let mut last_name: Option < String > = None ;
147144 let mut symlink_flag: bool = false ;
148145
@@ -152,27 +149,30 @@ pub fn execute_compress(
152149 let method = match method {
153150 CompressionMethodArg :: Stored => CompressionMethod :: Stored ,
154151 CompressionMethodArg :: Deflate => CompressionMethod :: Deflated ,
152+ #[ cfg( feature = "deflate64" ) ]
155153 CompressionMethodArg :: Deflate64 => CompressionMethod :: Deflate64 ,
154+ #[ cfg( feature = "bzip2" ) ]
156155 CompressionMethodArg :: Bzip2 => CompressionMethod :: Bzip2 ,
156+ #[ cfg( feature = "zstd" ) ]
157157 CompressionMethodArg :: Zstd => CompressionMethod :: Zstd ,
158158 } ;
159- write ! ( err, "setting compression method {method:?}\n " ) ?;
159+ writeln ! ( err, "setting compression method {method:?}" ) ?;
160160 options = options. compression_method ( method) ;
161161 }
162162 CompressionArg :: Level ( CompressionLevel ( level) ) => {
163- write ! ( err, "setting compression level {level:?}\n " ) ?;
163+ writeln ! ( err, "setting compression level {level:?}" ) ?;
164164 options = options. compression_level ( Some ( level) ) ;
165165 }
166166 CompressionArg :: Mode ( Mode ( mode) ) => {
167- write ! ( err, "setting file mode {mode:#o}\n " ) ?;
167+ writeln ! ( err, "setting file mode {mode:#o}" ) ?;
168168 options = options. unix_permissions ( mode) ;
169169 }
170170 CompressionArg :: LargeFile ( large_file) => {
171- write ! ( err, "setting large file flag to {large_file:?}\n " ) ?;
171+ writeln ! ( err, "setting large file flag to {large_file:?}" ) ?;
172172 options = options. large_file ( large_file) ;
173173 }
174174 CompressionArg :: Name ( name) => {
175- write ! ( err, "setting name of next entry to {name:?}\n " ) ?;
175+ writeln ! ( err, "setting name of next entry to {name:?}" ) ?;
176176 if let Some ( last_name) = last_name {
177177 return Err ( eyre ! (
178178 "got two names before an entry: {last_name} and {name}"
@@ -181,7 +181,7 @@ pub fn execute_compress(
181181 last_name = Some ( name) ;
182182 }
183183 CompressionArg :: Dir => {
184- write ! ( err, "writing dir entry\n " ) ?;
184+ writeln ! ( err, "writing dir entry" ) ?;
185185 if symlink_flag {
186186 return Err ( eyre ! ( "symlink flag provided before dir entry with " ) ) ;
187187 }
@@ -191,7 +191,7 @@ pub fn execute_compress(
191191 writer. add_directory ( dirname, options) ?;
192192 }
193193 CompressionArg :: Symlink => {
194- write ! ( err, "setting symlink flag for next entry\n " ) ?;
194+ writeln ! ( err, "setting symlink flag for next entry" ) ?;
195195 if symlink_flag {
196196 /* TODO: make this a warning? */
197197 return Err ( eyre ! ( "symlink flag provided twice before entry" ) ) ;
@@ -207,18 +207,18 @@ pub fn execute_compress(
207207 let target = data
208208 . into_string ( )
209209 . map_err ( |target| eyre ! ( "failed to decode symlink target {target:?}" ) ) ?;
210- write ! (
210+ writeln ! (
211211 err,
212- "writing immediate symlink entry with name {name:?} and target {target:?}\n "
212+ "writing immediate symlink entry with name {name:?} and target {target:?}"
213213 ) ?;
214214 /* TODO: .add_symlink() should support OsString targets! */
215215 writer. add_symlink ( name, target, options) ?;
216216 symlink_flag = false ;
217217 } else {
218218 /* This is a file entry. */
219- write ! (
219+ writeln ! (
220220 err,
221- "writing immediate file entry with name {name:?} and data {data:?}\n "
221+ "writing immediate file entry with name {name:?} and data {data:?}"
222222 ) ?;
223223 let data = data. into_encoded_bytes ( ) ;
224224 writer. start_file ( name, options) ?;
@@ -232,14 +232,14 @@ pub fn execute_compress(
232232 if symlink_flag {
233233 /* This is a symlink entry. */
234234 let target: String = path_to_string ( fs:: read_link ( & path) ?) . into ( ) ;
235- write ! ( err, "writing symlink entry from path {path:?} with name {name:?} and target {target:?}\n " ) ?;
235+ writeln ! ( err, "writing symlink entry from path {path:?} with name {name:?} and target {target:?}" ) ?;
236236 writer. add_symlink ( name, target, options) ?;
237237 symlink_flag = false ;
238238 } else {
239239 /* This is a file entry. */
240- write ! (
240+ writeln ! (
241241 err,
242- "writing file entry from path {path:?} with name {name:?}\n "
242+ "writing file entry from path {path:?} with name {name:?}"
243243 ) ?;
244244 writer. start_file ( name, options) ?;
245245 let mut f = fs:: File :: open ( path) ?;
@@ -250,9 +250,9 @@ pub fn execute_compress(
250250 if symlink_flag {
251251 return Err ( eyre ! ( "symlink flag provided before recursive dir entry" ) ) ;
252252 }
253- write ! (
253+ writeln ! (
254254 err,
255- "writing recursive dir entries for path {r:?} with name {last_name:?}\n "
255+ "writing recursive dir entries for path {r:?} with name {last_name:?}"
256256 ) ?;
257257 enter_recursive_dir_entries ( err, last_name. take ( ) , & r, & mut writer, options) ?;
258258 }
@@ -272,21 +272,21 @@ pub fn execute_compress(
272272 let file_type = fs:: symlink_metadata ( & pos_arg) ?. file_type ( ) ;
273273 if file_type. is_symlink ( ) {
274274 let target = fs:: read_link ( & pos_arg) ?;
275- write ! (
275+ writeln ! (
276276 err,
277- "writing positional symlink entry with path {pos_arg:?} and target {target:?}\n "
277+ "writing positional symlink entry with path {pos_arg:?} and target {target:?}"
278278 ) ?;
279279 writer. add_symlink_from_path ( pos_arg, target, options) ?;
280280 } else if file_type. is_file ( ) {
281- write ! ( err, "writing positional file entry with path {pos_arg:?}\n " ) ?;
281+ writeln ! ( err, "writing positional file entry with path {pos_arg:?}" ) ?;
282282 writer. start_file_from_path ( & pos_arg, options) ?;
283283 let mut f = fs:: File :: open ( pos_arg) ?;
284284 io:: copy ( & mut f, & mut writer) ?;
285285 } else {
286286 assert ! ( file_type. is_dir( ) ) ;
287- write ! (
287+ writeln ! (
288288 err,
289- "writing positional recursive dir entry for {pos_arg:?}\n "
289+ "writing positional recursive dir entry for {pos_arg:?}"
290290 ) ?;
291291 enter_recursive_dir_entries ( err, None , & pos_arg, & mut writer, options) ?;
292292 }
0 commit comments