fix: prompt for input on app cp
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@ -13,10 +13,10 @@ import (
 | 
			
		||||
	"github.com/sirupsen/logrus"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// GetContainer retrieves a container. If prompt is true and the retrievd count
 | 
			
		||||
// of containers does not match 1, then a prompt is presented to let the user
 | 
			
		||||
// choose. A count of 0 is handled gracefully.
 | 
			
		||||
func GetContainer(c context.Context, cl *client.Client, filters filters.Args, prompt bool) (types.Container, error) {
 | 
			
		||||
// GetContainer retrieves a container. If noInput is false and the retrievd
 | 
			
		||||
// count of containers does not match 1, then a prompt is presented to let the
 | 
			
		||||
// user choose. A count of 0 is handled gracefully.
 | 
			
		||||
func GetContainer(c context.Context, cl *client.Client, filters filters.Args, noInput bool) (types.Container, error) {
 | 
			
		||||
	containerOpts := types.ContainerListOptions{Filters: filters}
 | 
			
		||||
	containers, err := cl.ContainerList(c, containerOpts)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@ -37,7 +37,7 @@ func GetContainer(c context.Context, cl *client.Client, filters filters.Args, pr
 | 
			
		||||
			containersRaw = append(containersRaw, fmt.Sprintf("%s (created %v)", trimmed, created))
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if !prompt {
 | 
			
		||||
		if noInput {
 | 
			
		||||
			err := fmt.Errorf("expected 1 container but found %v: %s", len(containers), strings.Join(containersRaw, " "))
 | 
			
		||||
			return types.Container{}, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user