protected final void printCommandLine(@Nonnull String[] cmd, @CheckForNull FilePath workDir) {
        StringBuilder buf = new StringBuilder();
        if (workDir != null) {
            buf.append('[');
            if(showFullPath)
                buf.append(workDir.getRemote());
            else
                buf.append(workDir.getRemote().replaceFirst("^.+[/\\\\]", ""));
            buf.append("] ");
        }
        buf.append('$');
        for (String c : cmd) {
            buf.append(' ');
            if(c.indexOf(' ')>=0) {
                if(c.indexOf('"')>=0)
                    buf.append('\'').append(c).append('\'');
                else
                    buf.append('"').append(c).append('"');
            } else
                buf.append(c);
        }
        listener.getLogger().println(buf.toString());
        listener.getLogger().flush();
    }
protected final void printCommandLine ( @ Nonnull String [ ] cmd , @ CheckForNull FilePath workDir ) { StringBuilder buf = new StringBuilder ( ) ; if ( workDir != null ) { buf . append ( '[' ) ; if ( showFullPath ) buf . append ( workDir . getRemote ( ) ) ; else buf . append ( workDir . getRemote ( ) . replaceFirst ( "^.+[/\\\\]" , "" ) ) ; buf . append ( "] " ) ; } buf . append ( '$' ) ; for ( String c : cmd ) { buf . append ( ' ' ) ; if ( c . indexOf ( ' ' ) >= 0 ) { if ( c . indexOf ( '"' ) >= 0 ) buf . append ( '\'' ) . append ( c ) . append ( '\'' ) ; else buf . append ( '"' ) . append ( c ) . append ( '"' ) ; } else buf . append ( c ) ; } listener . getLogger ( ) . println ( buf . toString ( ) ) ; listener . getLogger ( ) . flush ( ) ; }
Prints out the command line to the listener so that users know what we are doing.