File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,7 @@ jobs:
197197
198198 - name : --chdir
199199 run : |
200+ set -x
200201 d=$(mktemp -d)
201202 test $(pwd) != $d
202203 test $(pkgx -C $d -- pwd) = $d
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2929 }
3030
3131 if flags. version_n_continue {
32- eprintln ! ( "pkgx {}" , env! ( "CARGO_PKG_VERSION" ) ) ;
32+ print_version ( flags . json . is_some ( ) ) ;
3333 }
3434
3535 match mode {
@@ -38,7 +38,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3838 Ok ( ( ) )
3939 }
4040 args:: Mode :: Version => {
41- println ! ( "pkgx {}" , env! ( "CARGO_PKG_VERSION" ) ) ;
41+ print_version ( flags . json . is_some ( ) ) ;
4242 Ok ( ( ) )
4343 }
4444 args:: Mode :: Query => {
@@ -100,3 +100,14 @@ async fn setup(
100100
101101 Ok ( ( conn, did_sync, config, spinner) )
102102}
103+
104+ fn print_version ( json : bool ) {
105+ if !json {
106+ eprintln ! ( "pkgx {}" , env!( "CARGO_PKG_VERSION" ) ) ;
107+ } else {
108+ eprintln ! (
109+ "{{\" program\" : \" pkgx\" , \" version\" : \" {}\" }}" ,
110+ env!( "CARGO_PKG_VERSION" )
111+ ) ;
112+ }
113+ }
You can’t perform that action at this time.
0 commit comments