File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ impl<'src> Justfile<'src> {
319319 if binding. export || module. settings . export {
320320 print ! ( "export " ) ;
321321 }
322- print ! ( "{}=\" " , binding. name) ;
322+ print ! ( "{}=\" " , binding. name. lexeme ( ) . replace ( '-' , "_" ) ) ;
323323 for c in binding. value . chars ( ) {
324324 if matches ! ( c, '!' | '"' | '$' | '\\' | '`' ) {
325325 print ! ( "\\ " ) ;
Original file line number Diff line number Diff line change @@ -312,3 +312,20 @@ fn format_shell_variables_are_exported_with_setting() {
312312 )
313313 . success ( ) ;
314314}
315+
316+ #[ test]
317+ fn format_shell_dashes_in_variables_are_replaced_with_underscores ( ) {
318+ Test :: new ( )
319+ . args ( [ "--evaluate" , "--evaluate-format" , "shell" ] )
320+ . justfile (
321+ "
322+ foo-bar := 'baz'
323+ " ,
324+ )
325+ . stdout (
326+ r#"
327+ foo_bar="baz"
328+ "# ,
329+ )
330+ . success ( ) ;
331+ }
You can’t perform that action at this time.
0 commit comments