terminus icon indicating copy to clipboard operation
terminus copied to clipboard

Commands should not require <site_name> and <env> in context

Open jameswilson opened this issue 4 years ago • 0 comments

Expected behavior

Inside a local copy of a git repository with pantheon upstream, I'm able to run terminus site:info without specifying the <site_name> argument, but terminus multidev:list and terminus multidev:create both fail.

There may be several other commands that I haven't stumbled upon yet that suffer this same problem, so ideally a comprehensive audit of all commands that have the <site_name> or <site>.<env> should be tested and confirmed they work without these parameters when executed from inside a git local copy.

Actual behavior

Commands fail to run as expected without the parameters.

$ cat .git/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
[remote "origin"]
	url = ssh://[email protected]:2222/~/repository.git
	fetch = +refs/heads/*:refs/remotes/origin/*

$ terminus multidev:list
  Not enough arguments (missing: "site_name").  
multidev:list [--format FORMAT] [--fields FIELDS] [--field FIELD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-y|--yes] [--filter [FILTER]] [--] <command> <site_name>

$ git checkout master
$ git pull
$ git checkout -b feature-1
 [ make changes and create a commit]
$ git push --set-upstream origin feature-1
     Skipping code sync, no Multidev environments were found for branch "feature-1".
$ terminus multidev:create 
 [error]  Could not find an environment identified by feature-1. 

Steps to reproduce the behavior

  1. Login to Pantheon Project Dashboard, copy/paste the Git connection info
  2. Paste git clone command into a local terminal window.
  3. Create a feature branch.
  4. Push the branch and notice the warning message: > Skipping code sync, no Multidev environments were found for branch "feature-branch".
  5. Run terminus command to list multidev environments without any <site_name> parameter.
  6. Run terminus command to create multidev environment without either the <site>.<env>nor the <multidev> parameters.

In theory, both steps 5 and 6 would be able to detect which branch you're on, and use the contextual information to do the right thing.

$ terminus self:info
 ------------------------- --------------------------------------------------------------------------------------------------- 
  PHP binary                /usr/local/Cellar/[email protected]/7.2.22_1/bin/php                                                         
  PHP version               7.2.22                                                                                             
  php.ini used              /usr/local/etc/php/7.2/php.ini                                                                     
  Terminus project config                                                                                                      
  Terminus root dir         /Users/jameswilson/.terminus/vendor/pantheon-systems/terminus                                      
  Terminus version          2.3.0                                                                                              
  Operating system          Darwin Kernel Version 18.7.0: Mon Feb 10 21:08:45 PST 2020; root:xnu-4903.278.28~1/RELEASE_X86_64  
 ------------------------- --------------------------------------------------------------------------------------------------- 

jameswilson avatar May 26 '20 16:05 jameswilson