Repository navigation
Add OS & shell information in 'info' command - #4604
Conversation
in 'info' command
add shell info
|
|
||
| $runner = WP_CLI::get_runner(); | ||
|
|
||
| $system_os = php_uname( 's' ); |
There was a problem hiding this comment.
Could you move this block before $runner = WP_CLI::get_runner(); please?
Also might as well give as much info as possible so:
$system_os = sprintf( '%s %s %s %s', php_uname( 's' ), php_uname( 'r' ), php_uname( 'v' ), php_uname( 'm' ) );
(only leaving out host name 'n' which people mightn't want exposed)?
| $runner = WP_CLI::get_runner(); | ||
|
|
||
| $system_os = php_uname( 's' ); | ||
| $system_architecture = php_uname( 'm' ); |
There was a problem hiding this comment.
So this system_architecture line would go.
|
|
||
| $system_os = php_uname( 's' ); | ||
| $system_architecture = php_uname( 'm' ); | ||
| $current_shell = ( isset( $_SERVER['SHELL'] ) ) ? $_SERVER['SHELL'] : ''; |
There was a problem hiding this comment.
I think just $shell for the variable - "current" doesn't add anything. Also could you use getenv() instead and for Windows use ComSpec if SHELL not available:
$shell = getenv( 'SHELL' );
if ( ! $shell && Utils\is_windows() ) {
$shell = getenv( 'ComSpec' );
}
There was a problem hiding this comment.
thanks @gitlost for this
if ( ! $shell && Utils\is_windows() ) {
$shell = getenv( 'ComSpec' );
}
i didn't know about this.
There was a problem hiding this comment.
Yeah, I've become a bit of a Windows guru over the last few weeks (don't use it locally or for servers)! ComSpec always returns path to cmd.exe, even on PowerShell, so isn't that great but looks a bit better anyway...
There was a problem hiding this comment.
I tested the code on Windows 7 ( installed VirtualBox just for that ) works perfectly:100:
| 'wp_cli_packages_dir_path' => $packages_dir, | ||
| 'wp_cli_version' => WP_CLI_VERSION, | ||
| 'system_os' => $system_os, | ||
| 'system_architecture' => $system_architecture, |
There was a problem hiding this comment.
So this line system_architecture goes.
| 'wp_cli_version' => WP_CLI_VERSION, | ||
| 'system_os' => $system_os, | ||
| 'system_architecture' => $system_architecture, | ||
| 'current_shell' => $current_shell, |
There was a problem hiding this comment.
And this becomes:
'shell' => $shell,
| WP_CLI::line( "WP-CLI global config:\t" . $runner->global_config_path ); | ||
| WP_CLI::line( "WP-CLI project config:\t" . $runner->project_config_path ); | ||
| WP_CLI::line( "WP-CLI version:\t" . WP_CLI_VERSION ); | ||
| WP_CLI::line( "Operating System:\t" . $system_os ); |
There was a problem hiding this comment.
Thinking just shorten Operating System to OS.
| WP_CLI::line( "WP-CLI project config:\t" . $runner->project_config_path ); | ||
| WP_CLI::line( "WP-CLI version:\t" . WP_CLI_VERSION ); | ||
| WP_CLI::line( "Operating System:\t" . $system_os ); | ||
| WP_CLI::line( "System Architecture:\t" . $system_architecture ); |
There was a problem hiding this comment.
And this line system_architecture goes.
| WP_CLI::line( "WP-CLI version:\t" . WP_CLI_VERSION ); | ||
| WP_CLI::line( "Operating System:\t" . $system_os ); | ||
| WP_CLI::line( "System Architecture:\t" . $system_architecture ); | ||
| WP_CLI::line( "Current Shell:\t" . $current_shell ); |
There was a problem hiding this comment.
And this line becomes:
WP_CLI::line( "Shell:\t" . $shell );
Also could you move both lines to the start, before PHP binary? Seems more logical to me and looks slightly better...
(The formatting here with tabs isn't good and we should be using a table but we'll leave it for the moment...)
#4599 add os and shell information in
wp cli info