Hello community,

here is the log from the commit of package platformsh-cli for openSUSE:Factory 
checked in at 2018-06-28 15:14:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old)
 and      /work/SRC/openSUSE:Factory/.platformsh-cli.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "platformsh-cli"

Thu Jun 28 15:14:42 2018 rev:51 rq:619453 version:3.33.6

Changes:
--------
--- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes    
2018-06-25 11:41:17.555934911 +0200
+++ /work/SRC/openSUSE:Factory/.platformsh-cli.new/platformsh-cli.changes       
2018-06-28 15:14:44.559447372 +0200
@@ -1,0 +2,10 @@
+Wed Jun 27 21:00:13 UTC 2018 - [email protected]
+
+- Update to version 3.33.6:
+  * Release v3.33.6
+  * Installer improvements (#730)
+  * Make environment labels consistent (#729)
+  * Refactor mount:size command; add --refresh option
+  * Get current deployment from cache
+
+-------------------------------------------------------------------

Old:
----
  platformsh-cli-3.33.5.tar.xz

New:
----
  platformsh-cli-3.33.6.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ platformsh-cli.spec ++++++
--- /var/tmp/diff_new_pack.M4miE3/_old  2018-06-28 15:14:45.123446339 +0200
+++ /var/tmp/diff_new_pack.M4miE3/_new  2018-06-28 15:14:45.123446339 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           platformsh-cli
-Version:        3.33.5
+Version:        3.33.6
 Release:        0
 Summary:        Tool for managing Platform.sh services from the command line
 # See licenses.txt for dependency licenses.

++++++ _service ++++++
--- /var/tmp/diff_new_pack.M4miE3/_old  2018-06-28 15:14:45.163446266 +0200
+++ /var/tmp/diff_new_pack.M4miE3/_new  2018-06-28 15:14:45.163446266 +0200
@@ -2,7 +2,7 @@
   <service name="tar_scm" mode="disabled">
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="versionrewrite-pattern">v(.*)</param>
-    <param name="revision">refs/tags/v3.33.5</param>
+    <param name="revision">refs/tags/v3.33.6</param>
     <param name="url">git://github.com/platformsh/platformsh-cli.git</param>
     <param name="scm">git</param>
     <param name="changesgenerate">enable</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.M4miE3/_old  2018-06-28 15:14:45.179446237 +0200
+++ /var/tmp/diff_new_pack.M4miE3/_new  2018-06-28 15:14:45.179446237 +0200
@@ -1,6 +1,6 @@
 <servicedata>
   <service name="tar_scm">
     <param name="url">git://github.com/platformsh/platformsh-cli.git</param>
-    <param 
name="changesrevision">ae5f1e8a7640331288f1b22ca28149f796ac586b</param>
+    <param 
name="changesrevision">126d22e278420e33589fc7506bb171bf96b231c8</param>
   </service>
 </servicedata>

++++++ platformsh-cli-3.33.5.tar.xz -> platformsh-cli-3.33.6.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/platformsh-cli-3.33.5/README.md 
new/platformsh-cli-3.33.6/README.md
--- old/platformsh-cli-3.33.5/README.md 2018-06-22 18:26:15.000000000 +0200
+++ new/platformsh-cli-3.33.6/README.md 2018-06-27 16:53:05.000000000 +0200
@@ -252,6 +252,7 @@
 * `PLATFORMSH_CLI_DEBUG`: set to 1 to enable cURL debugging. _Warning_: this 
will print all request information in the terminal, including sensitive access 
tokens.
 * `PLATFORMSH_CLI_DISABLE_CACHE`: set to 1 to disable caching
 * `PLATFORMSH_CLI_SESSION_ID`: change user session (default 'default')
+* `PLATFORMSH_CLI_SHELL_CONFIG_FILE`: specify the shell configuration file 
that the installer should write to (as an absolute path). If not set, a file 
such as `~/.bashrc` will be chosen automatically. Set this to an empty string 
to disable writing to a shell config file.
 * `PLATFORMSH_CLI_TOKEN`: an API token. _Warning_: storing a secret in an 
environment variable can be insecure. It may be better to use `config.yaml` as 
above, depending on your system. The environment variable is preferable on CI 
systems like Jenkins and GitLab.
 * `PLATFORMSH_CLI_UPDATES_CHECK`: set to 0 to disable the automatic updates 
check
 * `CLICOLOR_FORCE`: set to 1 or 0 to force colorized output on or off, 
respectively
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/platformsh-cli-3.33.5/config.yaml 
new/platformsh-cli-3.33.6/config.yaml
--- old/platformsh-cli-3.33.5/config.yaml       2018-06-22 18:26:15.000000000 
+0200
+++ new/platformsh-cli-3.33.6/config.yaml       2018-06-27 16:53:05.000000000 
+0200
@@ -1,7 +1,7 @@
 # Metadata about the CLI application itself.
 application:
   name: 'Platform.sh CLI'
-  version: '3.33.5'
+  version: '3.33.6'
   executable: 'platform'
   package_name: 'platformsh/cli'
   installer_url: 'https://platform.sh/cli/installer'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/platformsh-cli-3.33.5/dist/installer.php 
new/platformsh-cli-3.33.6/dist/installer.php
--- old/platformsh-cli-3.33.5/dist/installer.php        2018-06-22 
18:26:15.000000000 +0200
+++ new/platformsh-cli-3.33.6/dist/installer.php        2018-06-27 
16:53:05.000000000 +0200
@@ -303,7 +303,7 @@
     // Everywhere else, default to ANSI if stdout is a terminal.
     return (DIRECTORY_SEPARATOR == '\\')
         ? (false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'))
-        : (function_exists('posix_isatty') && posix_isatty(1));
+        : (function_exists('posix_isatty') && posix_isatty(STDOUT));
 }
 
 /**
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/platformsh-cli-3.33.5/dist/manifest.json 
new/platformsh-cli-3.33.6/dist/manifest.json
--- old/platformsh-cli-3.33.5/dist/manifest.json        2018-06-22 
18:26:15.000000000 +0200
+++ new/platformsh-cli-3.33.6/dist/manifest.json        2018-06-27 
16:53:05.000000000 +0200
@@ -1,10 +1,10 @@
 [
     {
         "name": "platform.phar",
-        "sha1": "5deade66f24de45b2a43062b77f8c4605a3b29b8",
-        "sha256": 
"92ee535e80b5d77be90d5a172e01e0af316377ab1e2414d7c6d83469356b9901",
-        "url": 
"https://github.com/platformsh/platformsh-cli/releases/download/v3.33.5/platform.phar";,
-        "version": "3.33.5",
+        "sha1": "fbcb8e4bbc77137fd2d69d84cb8f9921ebb2e15f",
+        "sha256": 
"2cd77ad649be9acad3ad09f1ccebf8b0eb7d99cbd2526161a9d00695d4ba0608",
+        "url": 
"https://github.com/platformsh/platformsh-cli/releases/download/v3.33.6/platform.phar";,
+        "version": "3.33.6",
         "php": {
             "min": "5.5.9"
         },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/platformsh-cli-3.33.5/src/Command/CommandBase.php 
new/platformsh-cli-3.33.6/src/Command/CommandBase.php
--- old/platformsh-cli-3.33.5/src/Command/CommandBase.php       2018-06-22 
18:26:15.000000000 +0200
+++ new/platformsh-cli-3.33.6/src/Command/CommandBase.php       2018-06-27 
16:53:05.000000000 +0200
@@ -431,7 +431,7 @@
             && !empty($config['mapping'][$currentBranch])) {
             $environment = 
$this->api()->getEnvironment($config['mapping'][$currentBranch], $project, 
$refresh);
             if ($environment) {
-                $this->debug('Found mapped environment for branch ' . 
$currentBranch . ': ' . $environment->id);
+                $this->debug('Found mapped environment for branch ' . 
$currentBranch . ': ' . $this->api()->getEnvironmentLabel($environment));
                 return $environment;
             } else {
                 unset($config['mapping'][$currentBranch]);
@@ -446,7 +446,7 @@
             list(, $potentialEnvironment) = explode('/', $upstream, 2);
             $environment = $this->api()->getEnvironment($potentialEnvironment, 
$project, $refresh);
             if ($environment) {
-                $this->debug('Selected environment ' . $potentialEnvironment . 
', based on Git upstream: ' . $upstream);
+                $this->debug('Selected environment ' . 
$this->api()->getEnvironmentLabel($environment) . ', based on Git upstream: ' . 
$upstream);
                 return $environment;
             }
         }
@@ -463,7 +463,7 @@
                 }
             }
             if ($environment) {
-                $this->debug('Selected environment ' . $environment->id . ' 
based on branch name: ' . $currentBranch);
+                $this->debug('Selected environment ' . 
$this->api()->getEnvironmentLabel($environment) . ' based on branch name: ' . 
$currentBranch);
                 return $environment;
             }
         }
@@ -764,7 +764,7 @@
             }
 
             $this->environment = $environment;
-            $this->debug('Selected environment: ' . $environment->id);
+            $this->debug('Selected environment: ' . 
$this->api()->getEnvironmentLabel($environment));
             return;
         }
 
@@ -810,7 +810,7 @@
         try {
             $apps = array_map(function (WebApp $app) {
                 return $app->name;
-            }, 
$this->getSelectedEnvironment()->getCurrentDeployment()->webapps);
+            }, 
$this->api()->getCurrentDeployment($this->getSelectedEnvironment())->webapps);
             if (!count($apps)) {
                 return null;
             }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/platformsh-cli-3.33.5/src/Command/Environment/EnvironmentActivateCommand.php
 
new/platformsh-cli-3.33.6/src/Command/Environment/EnvironmentActivateCommand.php
--- 
old/platformsh-cli-3.33.5/src/Command/Environment/EnvironmentActivateCommand.php
    2018-06-22 18:26:15.000000000 +0200
+++ 
new/platformsh-cli-3.33.6/src/Command/Environment/EnvironmentActivateCommand.php
    2018-06-27 16:53:05.000000000 +0200
@@ -67,24 +67,23 @@
         /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
         $questionHelper = $this->getService('question_helper');
         foreach ($environments as $environment) {
-            $environmentId = $environment->id;
             if (!$this->api()->checkEnvironmentOperation('activate', 
$environment)) {
                 if ($environment->isActive()) {
-                    $output->writeln("The environment 
<info>$environmentId</info> is already active.");
+                    $output->writeln("The environment " . 
$this->api()->getEnvironmentLabel($environment) . " is already active.");
                     $count--;
                     continue;
                 }
 
                 $output->writeln(
-                    "Operation not available: The environment 
<error>$environmentId</error> can't be activated."
+                    "Operation not available: The environment " . 
$this->api()->getEnvironmentLabel($environment, 'error') . " can't be 
activated."
                 );
                 continue;
             }
-            $question = "Are you sure you want to activate the environment 
<info>$environmentId</info>?";
+            $question = "Are you sure you want to activate the environment " . 
$this->api()->getEnvironmentLabel($environment) . "?";
             if (!$questionHelper->confirm($question)) {
                 continue;
             }
-            $process[$environmentId] = $environment;
+            $process[$environment->id] = $environment;
         }
         $activities = [];
         /** @var Environment $environment */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/platformsh-cli-3.33.5/src/Command/Environment/EnvironmentBranchCommand.php 
new/platformsh-cli-3.33.6/src/Command/Environment/EnvironmentBranchCommand.php
--- 
old/platformsh-cli-3.33.5/src/Command/Environment/EnvironmentBranchCommand.php  
    2018-06-22 18:26:15.000000000 +0200
+++ 
new/platformsh-cli-3.33.6/src/Command/Environment/EnvironmentBranchCommand.php  
    2018-06-27 16:53:05.000000000 +0200
@@ -84,7 +84,7 @@
 
         if (!$this->api()->checkEnvironmentOperation('branch', 
$parentEnvironment)) {
             $this->stdErr->writeln(
-                "Operation not available: The environment 
<error>{$parentEnvironment->id}</error> can't be branched."
+                "Operation not available: The environment " . 
$this->api()->getEnvironmentLabel($parentEnvironment, 'error') . " can't be 
branched."
             );
             if ($parentEnvironment->is_dirty) {
                 $this->api()->clearEnvironmentsCache($selectedProject->id);
@@ -109,13 +109,16 @@
             return 1;
         }
 
+        $title = $input->getOption('title') ?: $branchName;
+
         $this->stdErr->writeln(sprintf(
-            'Creating a new environment <info>%s</info>, branched from 
<info>%s</info>',
-            $branchName,
-            $parentEnvironment->title
+            'Creating a new environment %s, branched from %s',
+            $title && $title !== $branchName
+                ? '<info>' . $title . '</info> (' . $branchName . ')'
+                : '<info>' . $branchName . '</info>',
+            $this->api()->getEnvironmentLabel($parentEnvironment)
         ));
 
-        $title = $input->getOption('title') ?: $branchName;
         $activity = $parentEnvironment->branch($title, $branchName, 
!$input->getOption('no-clone-parent'));
 
         // Clear the environments cache, as branching has started.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/platformsh-cli-3.33.5/src/Command/Environment/EnvironmentCheckoutCommand.php
 
new/platformsh-cli-3.33.6/src/Command/Environment/EnvironmentCheckoutCommand.php
--- 
old/platformsh-cli-3.33.5/src/Command/Environment/EnvironmentCheckoutCommand.php
    2018-06-22 18:26:15.000000000 +0200
+++ 
new/platformsh-cli-3.33.6/src/Command/Environment/EnvironmentCheckoutCommand.php
    2018-06-27 16:53:05.000000000 +0200
@@ -110,14 +110,15 @@
         $environments = $this->api()->getEnvironments($project);
         $currentEnvironment = $this->getCurrentEnvironment($project);
         if ($currentEnvironment) {
-            $this->stdErr->writeln("The current environment is 
<info>{$currentEnvironment->title}</info>.");
+            $this->stdErr->writeln("The current environment is " . 
$this->api()->getEnvironmentLabel($currentEnvironment) . ".");
+            $this->stdErr->writeln('');
         }
         $environmentList = [];
         foreach ($environments as $id => $environment) {
             if ($currentEnvironment && $id == $currentEnvironment->id) {
                 continue;
             }
-            $environmentList[$id] = $environment->title;
+            $environmentList[$id] = 
$this->api()->getEnvironmentLabel($environment, false);
         }
         /** @var \Platformsh\Cli\Local\LocalProject $localProject */
         $localProject = $this->getService('local.project');
@@ -150,8 +151,12 @@
 
         // If there's only one choice, QuestionHelper::choose() does not
         // interact. But we still need interactive confirmation at this point.
-        if ($helper->confirm(sprintf('Check out environment <info>%s</info>?', 
reset($environmentList)))) {
-            return key($environmentList);
+        $environmentId = key($environmentList);
+        if ($environmentId !== false) {
+            $label = 
$this->api()->getEnvironmentLabel($environments[$environmentId]);
+            if ($helper->confirm(sprintf('Check out environment %s?', 
$label))) {
+                return $environmentId;
+            }
         }
 
         return false;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/platformsh-cli-3.33.5/src/Command/Mount/MountSizeCommand.php 
new/platformsh-cli-3.33.6/src/Command/Mount/MountSizeCommand.php
--- old/platformsh-cli-3.33.5/src/Command/Mount/MountSizeCommand.php    
2018-06-22 18:26:15.000000000 +0200
+++ new/platformsh-cli-3.33.6/src/Command/Mount/MountSizeCommand.php    
2018-06-27 16:53:05.000000000 +0200
@@ -20,7 +20,8 @@
         $this
             ->setName('mount:size')
             ->setDescription('Check the disk usage of mounts')
-            ->addOption('bytes', 'B', InputOption::VALUE_NONE, 'Show sizes in 
bytes');
+            ->addOption('bytes', 'B', InputOption::VALUE_NONE, 'Show sizes in 
bytes')
+            ->addOption('refresh', null, InputOption::VALUE_NONE, 'Refresh the 
cache');
         Table::configureInput($this->getDefinition());
         Ssh::configureInput($this->getDefinition());
         $this->addProjectOption();
@@ -37,7 +38,7 @@
 
         $appName = $this->selectApp($input);
 
-        $appConfig = $this->getAppConfig($appName);
+        $appConfig = $this->getAppConfig($appName, 
$input->getOption('refresh'));
         if (empty($appConfig['mounts'])) {
             $this->stdErr->writeln(sprintf('The app "%s" doesn\'t define any 
mounts.', $appConfig['name']));
 
@@ -68,6 +69,7 @@
         $commands[] = 'df -P -B1 -a -x squashfs -x tmpfs -x sysfs -x proc -x 
devpts -x rpc_pipefs';
         $commands[] = 'echo';
         $commands[] = 'cd "$' . $appDirVar . '"';
+
         foreach ($mountPaths as $mountPath) {
             $commands[] = 'du --block-size=1 -s ' . escapeshellarg($mountPath);
         }
@@ -88,60 +90,16 @@
         // Separate the commands' output.
         list($appDir, $dfOutput, $duOutput) = explode("\n\n", $result, 3);
 
-        // Parse the output of 'df', building a list of results.
-        $results = [];
-        foreach (explode("\n", $dfOutput) as $i => $line) {
-            if ($i === 0) {
-                continue;
-            }
-            try {
-                $path = $this->getDfColumn($line, 'path');
-            } catch (\RuntimeException $e) {
-                $this->debug($e->getMessage());
-                continue;
-            }
-            if (strpos($path, $appDir . '/') !== 0) {
-                continue;
-            }
-            $mountPath = ltrim(substr($path, strlen($appDir)), '/');
-            if (!in_array($mountPath, $mountPaths)) {
-                continue;
-            }
-            $filesystem = $this->getDfColumn($line, 'filesystem');
-            if (isset($results[$filesystem])) {
-                $results[$filesystem]['mounts'][] = $mountPath;
-                continue;
-            }
-            $available = $this->getDfColumn($line, 'available');
-            $used = $this->getDfColumn($line, 'used');
-            $results[$filesystem] = [
-                'total' => $this->getDfColumn($line, 'total'),
-                'used' => $used,
-                'available' => $available,
-                'mounts' => [$mountPath],
-                'percent_used' => $used / $available * 100,
-            ];
-        }
-
-        // Parse the 'du' output.
-        $mountSizes = [];
-        $duOutputSplit = explode("\n", $duOutput, count($mountPaths));
-        foreach ($mountPaths as $i => $mountPath) {
-            if (!isset($duOutputSplit[$i])) {
-                throw new \RuntimeException("Failed to find row $i of 'du' 
command output: \n" . $duOutput);
-            }
-            list($mountSizes[$mountPath],) = explode("\t", $duOutputSplit[$i], 
2);
-        }
-
-        /** @var \Platformsh\Cli\Service\Table $table */
-        $table = $this->getService('table');
+        // Parse the output.
+        $volumeInfo = $this->parseDf($dfOutput, $appDir, $mountPaths);
+        $mountSizes = $this->parseDu($duOutput, $mountPaths);
 
+        // Build a table of results: one line per mount, one (multi-line) row
+        // per filesystem.
         $header = ['Mount(s)', 'Size(s)', 'Disk', 'Used', 'Available', 
'Capacity'];
-
-        $showInBytes = $input->getOption('bytes');
-
         $rows = [];
-        foreach ($results as $info) {
+        $showInBytes = $input->getOption('bytes');
+        foreach ($volumeInfo as $info) {
             $row = [];
             $row[] = implode("\n", $info['mounts']);
             $mountUsage = [];
@@ -163,6 +121,9 @@
             $rows[] = $row;
         }
 
+
+        /** @var \Platformsh\Cli\Service\Table $table */
+        $table = $this->getService('table');
         $table->render($rows, $header);
 
         return 0;
@@ -197,4 +158,74 @@
 
         return trim($matches[1]);
     }
+
+    /**
+     * Parse the output of 'df', building a list of results per FS volume.
+     *
+     * @param string $dfOutput
+     * @param string $appDir
+     * @param array  $mountPaths
+     *
+     * @return array
+     */
+    private function parseDf($dfOutput, $appDir, array $mountPaths)
+    {
+        $results = [];
+        foreach (explode("\n", $dfOutput) as $i => $line) {
+            if ($i === 0) {
+                continue;
+            }
+            try {
+                $path = $this->getDfColumn($line, 'path');
+            } catch (\RuntimeException $e) {
+                $this->debug($e->getMessage());
+                continue;
+            }
+            if (strpos($path, $appDir . '/') !== 0) {
+                continue;
+            }
+            $mountPath = ltrim(substr($path, strlen($appDir)), '/');
+            if (!in_array($mountPath, $mountPaths)) {
+                continue;
+            }
+            $filesystem = $this->getDfColumn($line, 'filesystem');
+            if (isset($results[$filesystem])) {
+                $results[$filesystem]['mounts'][] = $mountPath;
+                continue;
+            }
+            $available = $this->getDfColumn($line, 'available');
+            $used = $this->getDfColumn($line, 'used');
+            $results[$filesystem] = [
+                'total' => $this->getDfColumn($line, 'total'),
+                'used' => $used,
+                'available' => $available,
+                'mounts' => [$mountPath],
+                'percent_used' => $used / $available * 100,
+            ];
+        }
+
+        return $results;
+    }
+
+    /**
+     * Parse the 'du' output.
+     *
+     * @param string $duOutput
+     * @param array  $mountPaths
+     *
+     * @return array A list of mount sizes (in bytes) keyed by mount path.
+     */
+    private function parseDu($duOutput, array $mountPaths)
+    {
+        $mountSizes = [];
+        $duOutputSplit = explode("\n", $duOutput, count($mountPaths));
+        foreach ($mountPaths as $i => $mountPath) {
+            if (!isset($duOutputSplit[$i])) {
+                throw new \RuntimeException("Failed to find row $i of 'du' 
command output: \n" . $duOutput);
+            }
+            list($mountSizes[$mountPath],) = explode("\t", $duOutputSplit[$i], 
2);
+        }
+
+        return $mountSizes;
+    }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/platformsh-cli-3.33.5/src/Command/Self/SelfInstallCommand.php 
new/platformsh-cli-3.33.6/src/Command/Self/SelfInstallCommand.php
--- old/platformsh-cli-3.33.5/src/Command/Self/SelfInstallCommand.php   
2018-06-22 18:26:15.000000000 +0200
+++ new/platformsh-cli-3.33.6/src/Command/Self/SelfInstallCommand.php   
2018-06-27 16:53:05.000000000 +0200
@@ -41,19 +41,39 @@
             $fs->dumpFile($configDir . '/' . $rcFile, $rcContents);
         }
 
-        $shellConfigFile = $this->findShellConfigFile();
+        $shellConfigOverrideVar = 
$this->config()->get('application.env_prefix') . 'SHELL_CONFIG_FILE';
+        $shellConfigOverride = getenv($shellConfigOverrideVar);
+        if ($shellConfigOverride === '') {
+            $this->debug(sprintf('Shell config detection disabled via %s', 
$shellConfigOverrideVar));
+            $shellConfigFile = false;
+        } elseif ($shellConfigOverride !== false) {
+            /** @var \Platformsh\Cli\Service\Filesystem $fsService */
+            $fsService = $this->getService('fs');
+            if (!$fsService->canWrite($shellConfigOverride)) {
+                throw new \RuntimeException(sprintf(
+                    'File not writable: %s (defined in %s)',
+                    $shellConfigOverride,
+                    $shellConfigOverrideVar
+                ));
+            }
+            $this->debug(sprintf('Shell config file specified via %s', 
$shellConfigOverrideVar));
+            $shellConfigFile = $shellConfigOverride;
+        } else {
+            $shellConfigFile = $this->findShellConfigFile();
+        }
 
         $currentShellConfig = '';
 
         if ($shellConfigFile !== false) {
-            $this->stdErr->writeln(sprintf('Selected shell configuration file: 
<info>%s</info>', $shellConfigFile));
+            $this->stdErr->writeln(sprintf('Selected shell configuration file: 
<info>%s</info>', $this->getShortPath($shellConfigFile)));
             if (file_exists($shellConfigFile)) {
                 $currentShellConfig = file_get_contents($shellConfigFile);
                 if ($currentShellConfig === false) {
-                    $this->stdErr->writeln('Failed to read file.');
+                    $this->stdErr->writeln('Failed to read file: <error>' . 
$shellConfigFile . '</error>');
                     return 1;
                 }
             }
+            $this->stdErr->writeln('');
         }
 
         $configDirRelative = $this->config()->getUserConfigDir(false);
@@ -69,7 +89,7 @@
         );
 
         if (strpos($currentShellConfig, $suggestedShellConfig) !== false) {
-            $this->stdErr->writeln('Already configured.');
+            $this->stdErr->writeln('Already configured: <info>' . 
$this->getShortPath($shellConfigFile) . '</info>');
             $this->stdErr->writeln('');
             $this->stdErr->writeln(sprintf(
                 "To use the %s, run:\n    <info>%s</info>",
@@ -82,13 +102,16 @@
         /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */
         $questionHelper = $this->getService('question_helper');
         $modify = false;
+        $create = false;
         if ($shellConfigFile !== false) {
             $confirmText = file_exists($shellConfigFile)
                 ? 'Do you want to update the file automatically?'
                 : 'Do you want to create the file automatically?';
             if ($questionHelper->confirm($confirmText)) {
                 $modify = true;
+                $create = !file_exists($shellConfigFile);
             }
+            $this->stdErr->writeln('');
         }
 
         $appName = (string) $this->config()->get('application.name');
@@ -101,8 +124,6 @@
                 . PHP_EOL
                 . $suggestedShellConfig
                 . ' ' . $end;
-            $this->stdErr->writeln('');
-
             if ($shellConfigFile !== false) {
                 $this->stdErr->writeln(sprintf(
                     'To set up the CLI, add the following lines to: 
<comment>%s</comment>',
@@ -145,39 +166,63 @@
                 $endPos + strlen($end) - $beginPos
             );
         } else {
-            $newShellConfig = rtrim($currentShellConfig, PHP_EOL)
-                . PHP_EOL . PHP_EOL
-                . $begin . PHP_EOL . $suggestedShellConfig . ' ' . $end
+            $newShellConfig = rtrim($currentShellConfig, PHP_EOL);
+            if (strlen($newShellConfig)) {
+                $newShellConfig .= PHP_EOL . PHP_EOL;
+            }
+            $newShellConfig .= $begin
+                . PHP_EOL . $suggestedShellConfig . ' ' . $end
                 . PHP_EOL;
         }
 
-        copy($shellConfigFile, $shellConfigFile . '.cli.bak');
+        if (file_exists($shellConfigFile)) {
+            copy($shellConfigFile, $shellConfigFile . '.cli.bak');
+        }
 
         if (!file_put_contents($shellConfigFile, $newShellConfig)) {
-            $this->stdErr->writeln(sprintf('Failed to modify configuration 
file: %s', $shellConfigFile));
+            $this->stdErr->writeln(sprintf('Failed to write to configuration 
file: %s', $shellConfigFile));
             return 1;
         }
 
-        $shortPath = $shellConfigFile;
-        if (getcwd() === dirname($shellConfigFile)) {
-            $shortPath = basename($shellConfigFile);
-        }
-        if (strpos($shortPath, ' ')) {
-            $shortPath = escapeshellarg($shortPath);
+        if ($create) {
+            $this->stdErr->writeln('Configuration file created successfully: 
<info>' . $this->getShortPath($shellConfigFile) . '</info>');
+        } else {
+            $this->stdErr->writeln('Configuration file updated successfully: 
<info>' . $this->getShortPath($shellConfigFile) . '</info>');
         }
 
-        $this->stdErr->writeln('Updated successfully.');
         $this->stdErr->writeln('');
         $this->stdErr->writeln([
             'To use the ' . $this->config()->get('application.name') . ', 
run:',
-            '    <info>source ' . $shortPath . '</info> # (or start a new 
terminal)',
-            '    <info>' . $this->config()->get('application.executable'),
+            '    <info>source '
+                . str_replace(' ', '\\ ', 
$this->getShortPath($shellConfigFile))
+                . '</info> # (or start a new terminal)',
+            '    <info>' . $this->config()->get('application.executable') . 
'</info>',
         ]);
 
         return 0;
     }
 
     /**
+     * Shorten a filename for display.
+     *
+     * @param string $filename
+     *
+     * @return string
+     */
+    private function getShortPath($filename)
+    {
+        if (getcwd() === dirname($filename)) {
+            return basename($filename);
+        }
+        $homeDir = Filesystem::getHomeDirectory();
+        if (strpos($filename, $homeDir) === 0) {
+            return str_replace($homeDir, '~', $filename);
+        }
+
+        return $filename;
+    }
+
+    /**
      * Finds a shell configuration file for the user.
      *
      * @return string|false
@@ -193,26 +238,35 @@
             return getenv($envPrefix . 'APP_DIR') . '/.environment';
         }
 
+        $shell = null;
+        if (getenv('SHELL') !== false) {
+            $shell = basename(getenv('SHELL'));
+            $this->debug('Detected shell: ' . $shell);
+        }
+
         $candidates = [
             '.bash_profile',
             '.bashrc',
         ];
-        if (basename(getenv('SHELL')) === 'zsh' || getenv('ZSH')) {
+        if ($shell === 'zsh' || getenv('ZSH')) {
             array_unshift($candidates, '.zshrc');
             array_unshift($candidates, '.zprofile');
         }
         $homeDir = Filesystem::getHomeDirectory();
         foreach ($candidates as $candidate) {
             if (file_exists($homeDir . DIRECTORY_SEPARATOR . $candidate)) {
+                $this->debug('Found existing config file: ' . $homeDir . 
DIRECTORY_SEPARATOR . $candidate);
+
                 return $homeDir . DIRECTORY_SEPARATOR . $candidate;
             }
         }
 
-        // If none of the files exist (yet), then pick the first one.
-        if (is_writable($homeDir)) {
-            $filename = reset($candidates) ?: '.bash_profile';
+        // If none of the files exist (yet), and we are on Bash, and the home
+        // directory is writable, then use ~/.bashrc.
+        if (is_writable($homeDir) && $shell === 'bash') {
+            $this->debug('Defaulting to ~/.bashrc');
 
-            return $homeDir . DIRECTORY_SEPARATOR . $filename;
+            return $homeDir . DIRECTORY_SEPARATOR . '.bashrc';
         }
 
         return false;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/platformsh-cli-3.33.5/src/Service/Api.php 
new/platformsh-cli-3.33.6/src/Service/Api.php
--- old/platformsh-cli-3.33.5/src/Service/Api.php       2018-06-22 
18:26:15.000000000 +0200
+++ new/platformsh-cli-3.33.6/src/Service/Api.php       2018-06-27 
16:53:05.000000000 +0200
@@ -620,6 +620,27 @@
     }
 
     /**
+     * Returns an environment label.
+     *
+     * @param Environment  $environment
+     * @param string|false $tag
+     *
+     * @return string
+     */
+    public function getEnvironmentLabel(Environment $environment, $tag = 
'info')
+    {
+        $id = $environment->id;
+        $title = $environment->title;
+        $use_title = $title && $title !== $id;
+        $pattern = $use_title ? '%2$s (%3$s)' : '%3$s';
+        if ($tag !== false) {
+            $pattern = $use_title ? '<%1$s>%2$s</%1$s> (%3$s)' : 
'<%1$s>%3$s</%1$s>';
+        }
+
+        return sprintf($pattern, $tag, $title, $id);
+    }
+
+    /**
      * Get a resource, matching on the beginning of the ID.
      *
      * @param string        $id

++++++ platformsh-cli-vendor.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vendor/autoload.php new/vendor/autoload.php
--- old/vendor/autoload.php     2018-06-22 22:53:03.501903712 +0200
+++ new/vendor/autoload.php     2018-06-27 23:00:16.282343063 +0200
@@ -4,4 +4,4 @@
 
 require_once __DIR__ . '/composer/autoload_real.php';
 
-return ComposerAutoloaderInitd403ec1200349c41bc7fad0285935c50::getLoader();
+return ComposerAutoloaderInite9ae40f4d976980c7503956068f39223::getLoader();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vendor/composer/autoload_real.php 
new/vendor/composer/autoload_real.php
--- old/vendor/composer/autoload_real.php       2018-06-22 22:53:03.501903712 
+0200
+++ new/vendor/composer/autoload_real.php       2018-06-27 23:00:16.282343063 
+0200
@@ -2,7 +2,7 @@
 
 // autoload_real.php @generated by Composer
 
-class ComposerAutoloaderInitd403ec1200349c41bc7fad0285935c50
+class ComposerAutoloaderInite9ae40f4d976980c7503956068f39223
 {
     private static $loader;
 
@@ -19,15 +19,15 @@
             return self::$loader;
         }
 
-        
spl_autoload_register(array('ComposerAutoloaderInitd403ec1200349c41bc7fad0285935c50',
 'loadClassLoader'), true, true);
+        
spl_autoload_register(array('ComposerAutoloaderInite9ae40f4d976980c7503956068f39223',
 'loadClassLoader'), true, true);
         self::$loader = $loader = new \Composer\Autoload\ClassLoader();
-        
spl_autoload_unregister(array('ComposerAutoloaderInitd403ec1200349c41bc7fad0285935c50',
 'loadClassLoader'));
+        
spl_autoload_unregister(array('ComposerAutoloaderInite9ae40f4d976980c7503956068f39223',
 'loadClassLoader'));
 
         $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') 
&& (!function_exists('zend_loader_file_encoded') || 
!zend_loader_file_encoded());
         if ($useStaticLoader) {
             require_once __DIR__ . '/autoload_static.php';
 
-            
call_user_func(\Composer\Autoload\ComposerStaticInitd403ec1200349c41bc7fad0285935c50::getInitializer($loader));
+            
call_user_func(\Composer\Autoload\ComposerStaticInite9ae40f4d976980c7503956068f39223::getInitializer($loader));
         } else {
             $map = require __DIR__ . '/autoload_namespaces.php';
             foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@
         $loader->register(true);
 
         if ($useStaticLoader) {
-            $includeFiles = 
Composer\Autoload\ComposerStaticInitd403ec1200349c41bc7fad0285935c50::$files;
+            $includeFiles = 
Composer\Autoload\ComposerStaticInite9ae40f4d976980c7503956068f39223::$files;
         } else {
             $includeFiles = require __DIR__ . '/autoload_files.php';
         }
         foreach ($includeFiles as $fileIdentifier => $file) {
-            composerRequired403ec1200349c41bc7fad0285935c50($fileIdentifier, 
$file);
+            composerRequiree9ae40f4d976980c7503956068f39223($fileIdentifier, 
$file);
         }
 
         return $loader;
     }
 }
 
-function composerRequired403ec1200349c41bc7fad0285935c50($fileIdentifier, 
$file)
+function composerRequiree9ae40f4d976980c7503956068f39223($fileIdentifier, 
$file)
 {
     if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
         require $file;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vendor/composer/autoload_static.php 
new/vendor/composer/autoload_static.php
--- old/vendor/composer/autoload_static.php     2018-06-22 22:53:03.501903712 
+0200
+++ new/vendor/composer/autoload_static.php     2018-06-27 23:00:16.278343024 
+0200
@@ -4,7 +4,7 @@
 
 namespace Composer\Autoload;
 
-class ComposerStaticInitd403ec1200349c41bc7fad0285935c50
+class ComposerStaticInite9ae40f4d976980c7503956068f39223
 {
     public static $files = array (
         '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . 
'/symfony/polyfill-mbstring/bootstrap.php',
@@ -195,9 +195,9 @@
     public static function getInitializer(ClassLoader $loader)
     {
         return \Closure::bind(function () use ($loader) {
-            $loader->prefixLengthsPsr4 = 
ComposerStaticInitd403ec1200349c41bc7fad0285935c50::$prefixLengthsPsr4;
-            $loader->prefixDirsPsr4 = 
ComposerStaticInitd403ec1200349c41bc7fad0285935c50::$prefixDirsPsr4;
-            $loader->classMap = 
ComposerStaticInitd403ec1200349c41bc7fad0285935c50::$classMap;
+            $loader->prefixLengthsPsr4 = 
ComposerStaticInite9ae40f4d976980c7503956068f39223::$prefixLengthsPsr4;
+            $loader->prefixDirsPsr4 = 
ComposerStaticInite9ae40f4d976980c7503956068f39223::$prefixDirsPsr4;
+            $loader->classMap = 
ComposerStaticInite9ae40f4d976980c7503956068f39223::$classMap;
 
         }, null, ClassLoader::class);
     }


Reply via email to