text:
#include "hexlineedit.h"

#if QT_VERSION_MAJOR >= 6
#include <QRegularExpression>
#else
#include <QRegExp>
#endif

HexLineEdit::HexLineEdit(QWidget * parent)
:QLineEdit(parent)
{
    m_editAsGuid = false;
}

HexLineEdit::HexLineEdit(const QString & contents, QWidget * parent)
:QLineEdit(contents, parent)
{
    m_editAsGuid = false;
}

HexLineEdit::~HexLineEdit()
{
}

void HexLineEdit::keyPressEvent(QKeyEvent * event)
{
    QClipboard *clipboard;
    QString originalText;

    if (m_editAsGuid && (event == QKeySequence::Delete || event->key() == Qt::Key_Backspace))
    {
        int pos = cursorPosition();
        if (event->key() == Qt::Key_Backspace && pos > 0) {
            cursorBackward(false);
            pos = cursorPosition();
        }

        QString txt = text();
        QString selected = selectedText();

        if (!selected.isEmpty()) {
            pos = QLineEdit::selectionStart();
            for (int i = pos; i < pos + selected.length(); i++)
                if (txt[i] != QChar('-'))
                    txt[i] = QChar('.');
        }
        else {
            txt[pos] = QChar('.');
        }

        setCursorPosition(0);
        insert(txt);
        setCursorPosition(pos);

        return;
    }

    if (event == QKeySequence::Paste)
    {
        clipboard = QApplication::clipboard();
        originalText = clipboard->text();
        QString cleanedHex = QString(originalText).replace(QString("0x"), QString(""), Qt::CaseInsensitive);
#if QT_VERSION_MAJOR >= 6
        cleanedHex.remove(QRegularExpression("[^a-fA-F\\d]+"));
#else
        cleanedHex.remove(QRegExp("[^a-fA-F\\d]+"));
#endif
        clipboard->setText(cleanedHex);
    }

    // Call original event handler
    QLineEdit::keyPressEvent(event);

    if (event == QKeySequence::Paste)
    {
        clipboard->setText(originalText);
    }
}


text:
import unittest, os, json
from subprocess import PIPE, STDOUT
from proton import Message, PENDING, ACCEPTED, REJECTED, RELEASED, SSLDomain, SSLUnavailable, Timeout
from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process
from proton.handlers import MessagingHandler
from proton.reactor import Container, DynamicNodeProperties

# PROTON-828:
try:
    from proton import MODIFIED
except ImportError:
    from proton import PN_STATUS_MODIFIED as MODIFIED

class RouterTest(TestCase):

    inter_router_port = None

    @classmethod
    def setUpClass(cls):
        """Start a router"""
        super(RouterTest, cls).setUpClass()

        def router(name):

            config = [
                ('router', {'mode': 'standalone', 'id': name}),
                ('listener', {'port': cls.tester.get_port()}),
                ('address', {'prefix': 'multicast', 'distribution' : 'multicast'}),
            ]

            config = Qdrouterd.Config(config)

            cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))

        cls.routers = []

        inter_router_port = cls.tester.get_port()

        router('A')
        cls.routers[0].wait_ready()

    def test_01_default_multicast_test(self):
        test = DeniedUnsettledMulticastTest(self.routers[0].addresses[0])
        test.run()
        self.assertEqual(None, test.error)

class Timeout(object):
    def __init__(self, parent):
        self.parent = parent

    def on_timer_task(self, event):
        self.parent.timeout()

class DeniedUnsettledMulticastTest(MessagingHandler):
    def __init__(self, host):
        super(DeniedUnsettledMulticastTest, self).__init__()
        self.host       = host
        self.count      = 10
        self.error      = None
        self.addr       = "multicast/test"
        self.sent_uns   = 0
        self.sent_pres  = 0
        self.n_received = 0
        self.n_rejected = 0

    def timeout(self):
        self.error = "Timeout Expired - n_received=%d n_rejected=%d" % (self.n_received, self.n_rejected)
        self.conn.close()

    def check_done(self):
        if self.n_received == self.count and self.n_rejected == self.count:
            self.conn.close()
            self.timer.cancel()

    def send(self):
        while self.sent_uns < self.count:
            m = Message(body="Unsettled %d" % self.sent_uns)
            self.sender.send(m)
            self.sent_uns += 1
        while self.sent_pres < self.count:
            m = Message(body="Presettled %d" % self.sent_pres)
            dlv = self.sender.send(m)
            dlv.settle()
            self.sent_pres += 1

    def on_start(self, event):
        self.timer    = event.reactor.schedule(TIMEOUT, Timeout(self))
        self.conn     = event.container.connect(self.host)
        self.receiver = event.container.create_receiver(self.conn, self.addr)
        self.sender   = event.container.create_sender(self.conn, self.addr)

    def on_sendable(self, event):
        self.send()

    def on_message(self, event):
        self.n_received += 1
        self.check_done()

    def on_rejected(self, event):
        self.n_rejected += 1
        self.check_done()

    def run(self):
        Container(self).run()

if __name__ == '__main__':
    unittest.main(main_module())

redpajama_set_name: RedPajamaGithub


text:
These extensions are loaded early in the application startup and are
located here: config/initializers/00\_core\_extensions.rb

## Core Ruby Classes

### Hash

Hash is extended with a method: recursive\_symbolize\_keys which
Recursively converts the keys in a Hash to symbols.
It also converts the keys in any Array elements which are Hashes to
symbols.

Note: This extension has been moved to
lib/app\_settings.rb since it was required there for loading the
settings
file into APP\_CONFIG.

### Kernel

Kernel is extended with the method: suppress\_warnings

This enables selective supression of warnings from Ruby such as when
redefining
the constant: REST\_AUTH\_SITE\_KEY when running spec tests

See:
http://mentalized.net/journal/2010/04/02/suppress\_warnings\_from\_ruby/

### String

String is extended with the methods: underscore\_module,
delete\_module(num=1)

### Object

Object is extended with the method: `display_name`

`Object#display_name` calls into `LocalNames.instance#local_name_for` in
`lib/local_names.rb`.
The default behavior for `#display_name`, can be customized by editing
`config/local_names.yml`.

The return value for `#display_name` is determined by evaluating these
criterea:

1.  By default, the method returns a human readable version of an
    objects class name.
2.  Class Objects return a readable version of their own name.
3.  Strings return their value.
4.  If the object has redefeined "display\_name" that value is used.
5.  If there is an entry for the classname or string literal in
    `config/local_names.yml` its replacement value will be used.
    1.  The `default:` entry in `config/local_names.yml` is used by
        default.
    2.  A 'theme-spefic' value may be used instead by defining a section
        in the yaml with your themes name.

Sample `config/local_names.yml`:

    ---
    default:
      Portal::Clazz : Class
    smartgraphs:
      Portal::Clazz : Study Group


text:
package com.sagasu.playground;

import java.util.function.Function;
import java.util.function.Supplier;

public class MySupplier {
    public static void main(String[] args) {
        Supplier<String> xformOpperation = createCombineAndTransform("Hello", "World", (a) -> {
            return a.toUpperCase();
        });
        System.out.println(xformOpperation.get());
    }

    public static Supplier<String> createCombineAndTransform(String a, String b, Function<String,String> transformer){
        return () -> {
            String aa = a;
            String bb = b;
            if(transformer != null){
                aa = transformer.apply(a);
                bb = transformer.apply(b);
            }
            return aa + bb;
        };
    }
}


text:
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Date;

public class FractalPanel extends Canvas implements Runnable, MouseListener, MouseMotionListener {
	FractalPanel(Dimension size) {
		this.normalSize = size;
		this.calculatedSize = new Dimension(2 * (int)size.getWidth(), 2 * (int)size.getHeight());
		fm = new FractalMaker(this.normalSize, this.calculatedSize);
		fm.reset();

		fz = new FractalZoomer(this.normalSize, this.calculatedSize);
		this.targetFPSDelta = 1000 / 30; // Thousand millisec/30 FPS
		this.pushed = false;

		new Thread(this).start();
		addMouseListener(this);
	    addMouseMotionListener(this);
	}

	public void init() {
	}

	public void run() {
		long prev = new Date().getTime();
		long now = 0L;

		while (true) {
			now = new Date().getTime();

			if (now - prev < this.targetFPSDelta) {
				try { Thread.sleep(now - prev); }
				catch(InterruptedException e) { e.printStackTrace(); }
			}
			else {
				update(this.getGraphics());
				paint(this.getGraphics());
				prev = now;
			}
		}
	}

	public void update(Graphics g) {
		if (fm.getDone() && !fm.getFetched()) {
			fz.addImg(fm.getImg());
			fz.setDone(false); // The zoomer have a img to work on
			fm.setFetched(true);
		}

		if (fz.getAllowedToZoom() && fm.getDone() && fz.getAmountOfCalculatedImg() < 3) // If we are running out on new img's to zoom in on
			fm.reset();
	}

	public void paint(Graphics g) {
		if (fm.getNbrOfCalcImgs() != 0) {
			g.drawImage(fz.getTargetImg(), 0, 0, null);
			g.setColor(Color.WHITE);
			g.fillRect(8, 8, 100, 30);
			g.setColor(Color.BLACK);
			g.drawString("Fractal: " + Integer.toString(fz.getImgCounter()) + "/" + Integer.toString(fm.getNbrOfCalcImgs()), 10, 20);
			g.drawString("sec: " + Double.toString(((double)fz.getDelta()) / 1000), 10, 33);
		}
	}

	public void mouseClicked(MouseEvent e) {

		this.pushed = true;
		fm.getSquare().setTarget(tmpX, tmpY);
		fz.setAllowedToZoom(true);
		e.consume();

	}

	public void mouseEntered(MouseEvent e) { }
	public void mouseExited(MouseEvent e) { }
	public void mousePressed(MouseEvent e) { }
	public void mouseReleased(MouseEvent e) { }
	public void mouseDragged(MouseEvent e) { }
	public void mouseMoved(MouseEvent e) { }

	// Local variables
	private static final long serialVersionUID = -6991235636124112122L;
	private FractalMaker fm;
	private FractalZoomer fz;
	private Dimension normalSize;
	private Dimension calculatedSize;
	private int targetFPSDelta;
	private boolean pushed;
}


text:
import client from '../api'
import {
  FETCH_ENDPOINTS_START,
  FETCH_ENDPOINTS_SUCCESS,
  REFRESH_ENDPOINTS,
  SET_SORTING_FILTER,
  SET_ASCEND_FILTER
} from '../constants'
import {
  fetchHealthCheckList
} from './index'
import errorHandler from '../../helpers/errorHandler'

export const getEndpointsRequest = () => ({
  type: FETCH_ENDPOINTS_START
})

export const getEndpointsSuccess = apiList => ({
  type: FETCH_ENDPOINTS_SUCCESS,
  payload: apiList
})

// TODO: move to separate actions, cause duplicates with 'healthcheck.actions'
export const setSortingFilter = filter => ({
  type: SET_SORTING_FILTER,
  payload: filter
})

// TODO: move to separate actions, cause duplicates with 'healthcheck.actions'
export const setAscendingFilter = () => ({
  type: SET_ASCEND_FILTER
})

export const fetchEndpoints = () => async dispatch => {
  dispatch(getEndpointsRequest())
  dispatch(fetchHealthCheckList())

  try {
    const response = await client.get('apis')

    response && dispatch(getEndpointsSuccess(response.data))
  } catch (error) {
    errorHandler(dispatch)(error)
  }
}

export const refreshEndpoints = api => ({
  type: REFRESH_ENDPOINTS,
  payload: api
})


text:
package com.aw.example;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;

public class CircleBitmapDrawble extends BitmapDrawable {
	private final Matrix mShaderMatrix = new Matrix();
	private final RectF mSrcRectF = new RectF();
	private final RectF mDstRectF = new RectF();
	private final Paint mPaint = new Paint();
	private boolean mRefreshDrawState = true;

	public CircleBitmapDrawble(Resources res, String filepath) {
		super(res, filepath);
	}

	public CircleBitmapDrawble(Resources resources, Bitmap bm) {
		super(resources, bm);
	}

	@Override
	protected void onBoundsChange(Rect bounds) {
		if(!getBounds().equals(bounds))
			mRefreshDrawState = true;

		super.onBoundsChange(bounds);
	}

	@Override
	public void setAlpha(int alpha) {
		super.setAlpha(alpha);
		mPaint.setAlpha(alpha);
	}

	@Override
	public void draw(Canvas canvas) {
		if(mRefreshDrawState == true) {
			mPaint.setAntiAlias(true);
			mSrcRectF.set(0, 0,  getIntrinsicWidth(), getIntrinsicHeight());
			mDstRectF.set(getBounds());
			mShaderMatrix.setRectToRect(mSrcRectF, mDstRectF, Matrix.ScaleToFit.FILL);

			Bitmap bitmap = getBitmap();
			if( bitmap != null){
				final BitmapShader shader = new BitmapShader(getBitmap(), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
				shader.setLocalMatrix(mShaderMatrix);
				mPaint.setShader(shader);
			}

			mRefreshDrawState = false;
		}

		canvas.drawCircle(mDstRectF.centerX(), mDstRectF.centerY(), Math.min(mDstRectF.width()/2, mDstRectF.height()/2), mPaint);
	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Biblthca Lichenol. 92: 190 (2006)

#### Original name
Thelotrema homopastum Nyl.

### Remarks
null


text:
import counter = require('./counter');

describe('socket call counter', function() {
  // One wrapped call, then destroy.
  it('simple wrap', (done) => {
    var destroyCalled = false;
    var destructor = () => {
      destroyCalled = true;
    };

    var callCounter = new counter.Counter(destructor);
    var beforeSpy = spyOn(callCounter, 'before_').and.callThrough();
    var afterSpy = spyOn(callCounter, 'after_').and.callThrough();

    callCounter.wrap(() => {
      expect(beforeSpy).toHaveBeenCalled();
      expect(afterSpy).not.toHaveBeenCalled();

      return Promise.resolve(1);
    }).then((result:number) => {
      expect(result).toEqual(1);
      expect(afterSpy).toHaveBeenCalled();
      expect(destroyCalled).toBeFalsy();

      callCounter.discard();
    });

    callCounter.onceDestroyed().then(() => {
      expect(destroyCalled).toBeTruthy();
      done();
    });
  });
});


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using Microsoft.CodeAnalysis.GeneratedCodeRecognition;
using Microsoft.CodeAnalysis.Host;
using Xunit;

namespace Microsoft.CodeAnalysis.UnitTests
{
    public class GeneratedCodeRecognitionTests
    {
        [Fact]
        public void TestFileNamesNotGenerated()
        {
            TestFileNames(false,
                "",
                "Test",
                "Test.cs",
                "Test.vb",
                "AssemblyInfo.cs",
                "AssemblyInfo.vb",
                ".NETFramework,Version=v4.5.AssemblyAttributes.cs",
                ".NETFramework,Version=v4.5.AssemblyAttributes.vb",
                "Test.notgenerated.cs",
                "Test.notgenerated.vb",
                "Test.generated",
                "Test.designer");
        }

        [Fact]
        public void TestFileNamesGenerated()
        {
            TestFileNames(true,
                "TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92",
                "TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs",
                "TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.vb",
                "Test.designer.cs",
                "Test.designer.vb",
                "Test.Designer.cs",
                "Test.Designer.vb",
                "Test.generated.cs",
                "Test.generated.vb",
                "Test.g.cs",
                "Test.g.vb",
                "Test.g.i.cs",
                "Test.g.i.vb");
        }

        private static void TestFileNames(bool assertGenerated, params string[] fileNames)
        {
            var project = CreateProject();

            foreach (var fileName in fileNames)
            {
                var document = project.AddDocument(fileName, "");
                if (assertGenerated)
                {
                    Assert.True(IsGeneratedCode(document), string.Format("Expected file '{0}' to be interpreted as generated code", fileName));
                }
                else
                {
                    Assert.False(IsGeneratedCode(document), string.Format("Did not expect file '{0}' to be interpreted as generated code", fileName));
                }
            }
        }

        private static Project CreateProject(string language = LanguageNames.CSharp)
        {
            var projectName = "TestProject";
            var projectId = ProjectId.CreateNewId(projectName);
            return new AdhocWorkspace().CurrentSolution
                .AddProject(projectId, projectName, projectName, LanguageNames.CSharp)
                .GetProject(projectId);
        }

        private static bool IsGeneratedCode(Document document)
        {
            return document.Project.Solution.Workspace.Services.GetService<IGeneratedCodeRecognitionService>().IsGeneratedCode(document);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Util;

namespace Xamarin.BookReader.Views
{
    [Register("xamarin.bookreader.views.CustomTextView")]
    public class CustomTextView : TextView
    {
        private String txt;

        public CustomTextView(Context context): this(context, null)
        {

        }

        public CustomTextView(Context context, IAttributeSet attrs): this(context, attrs, 0)
        {

        }

        public CustomTextView(Context context, IAttributeSet attrs, int defStyleAttr):base(context, attrs, defStyleAttr)
        {
            Gravity = (GravityFlags.Left);
        }
    }
}


text:
<?php

namespace RunOpenCode\AssetsInjection\Tests\Compiler;

use Assetic\FilterManager;
use RunOpenCode\AssetsInjection\Compiler\ProcessAssetsFiltersPass;
use RunOpenCode\AssetsInjection\Container;
use RunOpenCode\AssetsInjection\Library\LibraryCollection;
use RunOpenCode\AssetsInjection\Library\LibraryDefinition;
use RunOpenCode\AssetsInjection\Resource\FileResource;
use RunOpenCode\AssetsInjection\Tests\Mockup\DummyFilter;
use RunOpenCode\AssetsInjection\Utils\AssetType;
use RunOpenCode\AssetsInjection\Value\CompilerPassResult;

/**
 * @codeCoverageIgnore
 */
class TestProcessAssetsFiltersPass extends \PHPUnit_Framework_TestCase
{
    /**
     * @var string
     */
    protected $outputDir;

    public function setUp()
    {
        $this->outputDir = realpath(__DIR__ . '/../Data/web/output');
        $this->emptyOutput();
    }

    public function tearDown()
    {
        $this->emptyOutput();
    }

    public function testProcessAssetWithoutFiltering()
    {
        $this->emptyOutput();
        $sourceFile = realpath(__DIR__ . '/../Data/web/js/myjavascript.js');

        $container = new Container(new LibraryCollection(array(
            new LibraryDefinition('mylib', array(
                new FileResource($sourceFile)
            ))
        )));

        $result = $this->getCompilerPass(false)->process($container);
        $this->assertInstanceOf(CompilerPassResult::class, $result);
        $this->assertFalse($result->isProcessingStopped());

        $files = glob(rtrim($this->outputDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '/*');

        $this->assertSame(0, count($files), 'File should not be processed.');
    }

    public function testProcessAssetWithFiltering()
    {
        $this->emptyOutput();
        $sourceFile = realpath(__DIR__ . '/../Data/web/js/myjavascript.js');

        $container = new Container(new LibraryCollection(array(
            new LibraryDefinition('mylib', array(
                new FileResource($sourceFile, array('filters' => array('mockup')))
            ))
        )));

        $result = $this->getCompilerPass(false)->process($container);
        $this->assertInstanceOf(CompilerPassResult::class, $result);
        $this->assertFalse($result->isProcessingStopped());

        $files = glob(rtrim($this->outputDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '/*');

        $this->assertSame(1, count($files), 'Only one file should be dumped into output dir.');
        $this->assertNotEquals(file_get_contents($sourceFile), file_get_contents($files[0]), 'Source and dumped files should not be same.');
        $this->assertNotSame(false, strpos(file_get_contents($files[0]), file_get_contents($sourceFile)));
        $this->assertNotSame(false, strpos(file_get_contents($files[0]), 'Provided content has been filtered successfully by "\\RunOpenCode\\AssetsInjection\\Tests\\Mockup\\DummyFilter":'), 'Dumped file should have filter mark.');

        $this->assertSame(AssetType::guessExtension($sourceFile), AssetType::guessExtension($files[0]), 'File has proper extension.');

        $this->assertFalse(array_key_exists('filters', $result->getContainer()->getLibraries()->getDefinition('mylib')->getResources()[0]->getOptions()));
    }

    public function testProcessAssetWithIncludedOptionalFilter()
    {
        $this->emptyOutput();
        $sourceFile = realpath(__DIR__ . '/../Data/web/js/myjavascript.js');

        $container = new Container(new LibraryCollection(array(
            new LibraryDefinition('mylib', array(
                new FileResource($sourceFile, array('filters' => array('?mockup')))
            ))
        )));

        $result = $this->getCompilerPass(false)->process($container);
        $this->assertInstanceOf(CompilerPassResult::class, $result);
        $this->assertFalse($result->isProcessingStopped());

        $files = glob(rtrim($this->outputDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '/*');

        $this->assertSame(1, count($files), 'Only one file should be dumped into output dir.');
        $this->assertNotEquals(file_get_contents($sourceFile), file_get_contents($files[0]), 'Source and dumped files should not be same.');
        $this->assertNotSame(false, strpos(file_get_contents($files[0]), file_get_contents($sourceFile)));
        $this->assertNotSame(false, strpos(file_get_contents($files[0]), 'Provided content has been filtered successfully by "\\RunOpenCode\\AssetsInjection\\Tests\\Mockup\\DummyFilter":'), 'Dumped file should have filter mark.');
        $this->assertSame('.prod.', substr($files[0], -8, 6), 'File name should contain ".prod.".');
        $this->assertSame(AssetType::guessExtension($sourceFile), AssetType::guessExtension($files[0]), 'File has proper extension.');

        $this->assertFalse(array_key_exists('filters', $result->getContainer()->getLibraries()->getDefinition('mylib')->getResources()[0]->getOptions()));
    }

    public function testProcessAssetWithExcludedOptionalFilter()
    {
        $this->emptyOutput();
        $sourceFile = realpath(__DIR__ . '/../Data/web/js/myjavascript.js');

        $container = new Container(new LibraryCollection(array(
            new LibraryDefinition('mylib', array(
                new FileResource($sourceFile, array('filters' => array('?mockup')))
            ))
        )));

        $result = $this->getCompilerPass(true)->process($container);
        $this->assertInstanceOf(CompilerPassResult::class, $result);
        $this->assertFalse($result->isProcessingStopped());

        $files = glob(rtrim($this->outputDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '/*');

        $this->assertSame(1, count($files), 'Only one file should be dumped into output dir.');
        $this->assertSame(file_get_contents($sourceFile), file_get_contents($files[0]), 'Source and dumped files should be same.');
        $this->assertSame('.dev.', substr($files[0], -7, 5), 'File name should contain ".dev.".');
        $this->assertSame(AssetType::guessExtension($sourceFile), AssetType::guessExtension($files[0]), 'File should have proper extension.');

        $this->assertFalse(array_key_exists('filters', $result->getContainer()->getLibraries()->getDefinition('mylib')->getResources()[0]->getOptions()));
    }

    private function emptyOutput()
    {
        chmod($this->outputDir, 0777);
        array_map('unlink', glob(rtrim($this->outputDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '/*', GLOB_BRACE));
    }

    private function getCompilerPass($development = false)
    {
        $filterManager = new FilterManager();
        $filterManager->set('mockup', new DummyFilter());

        return new ProcessAssetsFiltersPass($filterManager, array(
            'development' => $development,
            'output_dir' => $this->outputDir
        ));
    }
}


text:
import { $ } from './index'

// function

const a = () => {
  const source = '~/Downloads/test.txt'
  const { basename, dirname, extname, filename } = $.getName(source)

  if (basename !== 'test') throw new Error('1')
  if (dirname !== '~/Downloads') throw new Error('2')
  if (extname !== '.txt') throw new Error('3')
  if (filename !== 'test.txt') throw new Error('4')
}
a.description = 'default'

const b = () => {
  const source = 'C:\\Users\\mimiko\\Project\\fire-keeper\\readme.md'
  const { basename, dirname, extname, filename } = $.getName(source)

  if (basename !== 'readme') throw new Error('1')
  if (dirname !== 'C:/Users/mimiko/Project/fire-keeper') throw new Error('2')
  if (extname !== '.md') throw new Error('3')
  if (filename !== 'readme.md') throw new Error('4')
}
b.description = '@windows'

// export
export { a, b }


text:
package cmds

import (
	"archive/tar"
	"bufio"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
	"os/exec"
	"path/filepath"
	"strconv"
	"strings"

	prompt "github.com/c-bata/go-prompt"
	"github.com/gogo/protobuf/proto"
	"github.com/gogo/protobuf/types"
	"github.com/mattn/go-isatty"
	"github.com/spf13/cobra"

	"github.com/pachyderm/pachyderm/v2/src/client"
	"github.com/pachyderm/pachyderm/v2/src/internal/clientsdk"
	"github.com/pachyderm/pachyderm/v2/src/internal/cmdutil"
	"github.com/pachyderm/pachyderm/v2/src/internal/errors"
	"github.com/pachyderm/pachyderm/v2/src/internal/errutil"
	"github.com/pachyderm/pachyderm/v2/src/internal/grpcutil"
	"github.com/pachyderm/pachyderm/v2/src/internal/pager"
	"github.com/pachyderm/pachyderm/v2/src/internal/pfsload"
	"github.com/pachyderm/pachyderm/v2/src/internal/progress"
	"github.com/pachyderm/pachyderm/v2/src/internal/tabwriter"
	"github.com/pachyderm/pachyderm/v2/src/internal/tarutil"
	"github.com/pachyderm/pachyderm/v2/src/internal/uuid"
	"github.com/pachyderm/pachyderm/v2/src/pfs"
	"github.com/pachyderm/pachyderm/v2/src/server/cmd/pachctl/shell"
	"github.com/pachyderm/pachyderm/v2/src/server/pfs/pretty"
	txncmds "github.com/pachyderm/pachyderm/v2/src/server/transaction/cmds"
)

const (
	// DefaultParallelism is the default parallelism used by 'get file' and 'put file'.
	DefaultParallelism = 10
)

// Cmds returns a slice containing pfs commands.
func Cmds() []*cobra.Command {
	var commands []*cobra.Command

	var raw bool
	var output string
	outputFlags := cmdutil.OutputFlags(&raw, &output)

	var fullTimestamps bool
	timestampFlags := cmdutil.TimestampFlags(&fullTimestamps)

	var noPager bool
	pagerFlags := cmdutil.PagerFlags(&noPager)

	repoDocs := &cobra.Command{
		Short: "Docs for repos.",
		Long: `Repos, short for repository, are the top level data objects in Pachyderm.

Repos contain version-controlled directories and files. Files can be of any size
or type (e.g. csv, binary, images, etc).`,
	}
	commands = append(commands, cmdutil.CreateDocsAlias(repoDocs, "repo", " repo$"))

	var description string
	createRepo := &cobra.Command{
		Use:   "{{alias}} <repo>",
		Short: "Create a new repo.",
		Long:  "Create a new repo.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			err = txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				_, err = c.PfsAPIClient.CreateRepo(
					c.Ctx(),
					&pfs.CreateRepoRequest{
						Repo:        client.NewRepo(args[0]),
						Description: description,
					},
				)
				return err
			})
			return grpcutil.ScrubGRPC(err)
		}),
	}
	createRepo.Flags().StringVarP(&description, "description", "d", "", "A description of the repo.")
	commands = append(commands, cmdutil.CreateAlias(createRepo, "create repo"))

	updateRepo := &cobra.Command{
		Use:   "{{alias}} <repo>",
		Short: "Update a repo.",
		Long:  "Update a repo.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			err = txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				_, err = c.PfsAPIClient.CreateRepo(
					c.Ctx(),
					&pfs.CreateRepoRequest{
						Repo:        cmdutil.ParseRepo(args[0]),
						Description: description,
						Update:      true,
					},
				)
				return err
			})
			return grpcutil.ScrubGRPC(err)
		}),
	}
	updateRepo.Flags().StringVarP(&description, "description", "d", "", "A description of the repo.")
	shell.RegisterCompletionFunc(updateRepo, shell.RepoCompletion)
	commands = append(commands, cmdutil.CreateAlias(updateRepo, "update repo"))

	inspectRepo := &cobra.Command{
		Use:   "{{alias}} <repo>",
		Short: "Return info about a repo.",
		Long:  "Return info about a repo.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()
			repoInfo, err := c.PfsAPIClient.InspectRepo(c.Ctx(), &pfs.InspectRepoRequest{Repo: cmdutil.ParseRepo(args[0])})
			if err != nil {
				return err
			}
			if repoInfo == nil {
				return errors.Errorf("repo %s not found", args[0])
			}
			if raw {
				return cmdutil.Encoder(output, os.Stdout).EncodeProto(repoInfo)
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}
			ri := &pretty.PrintableRepoInfo{
				RepoInfo:       repoInfo,
				FullTimestamps: fullTimestamps,
			}
			return pretty.PrintDetailedRepoInfo(ri)
		}),
	}
	inspectRepo.Flags().AddFlagSet(outputFlags)
	inspectRepo.Flags().AddFlagSet(timestampFlags)
	shell.RegisterCompletionFunc(inspectRepo, shell.RepoCompletion)
	commands = append(commands, cmdutil.CreateAlias(inspectRepo, "inspect repo"))

	var all bool
	var repoType string
	listRepo := &cobra.Command{
		Short: "Return a list of repos.",
		Long:  "Return a list of repos. By default, hide system repos like pipeline metadata",
		Run: cmdutil.RunFixedArgs(0, func(args []string) error {
			if all && repoType != "" {
				return errors.Errorf("cannot set a repo type with --all")
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			if repoType == "" && !all {
				repoType = pfs.UserRepoType // default to user
			}
			repoInfos, err := c.ListRepoByType(repoType)
			if err != nil {
				return err
			}
			if raw {
				encoder := cmdutil.Encoder(output, os.Stdout)
				for _, repoInfo := range repoInfos {
					if err := encoder.EncodeProto(repoInfo); err != nil {
						return err
					}
				}
				return nil
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}

			header := pretty.RepoHeader
			if (len(repoInfos) > 0) && (repoInfos[0].AuthInfo != nil) {
				header = pretty.RepoAuthHeader
			}
			writer := tabwriter.NewWriter(os.Stdout, header)
			for _, repoInfo := range repoInfos {
				pretty.PrintRepoInfo(writer, repoInfo, fullTimestamps)
			}
			return writer.Flush()
		}),
	}
	listRepo.Flags().AddFlagSet(outputFlags)
	listRepo.Flags().AddFlagSet(timestampFlags)
	listRepo.Flags().BoolVar(&all, "all", false, "include system repos of all types")
	listRepo.Flags().StringVar(&repoType, "type", "", "only include repos of the given type")
	commands = append(commands, cmdutil.CreateAlias(listRepo, "list repo"))

	var force bool
	deleteRepo := &cobra.Command{
		Use:   "{{alias}} <repo>",
		Short: "Delete a repo.",
		Long:  "Delete a repo.",
		Run: cmdutil.RunBoundedArgs(0, 1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			request := &pfs.DeleteRepoRequest{
				Force: force,
			}
			if len(args) > 0 {
				if all {
					return errors.Errorf("cannot use the --all flag with an argument")
				}
				request.Repo = cmdutil.ParseRepo(args[0])
			} else if !all {
				return errors.Errorf("either a repo name or the --all flag needs to be provided")
			}

			err = txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				if all {
					_, err = c.PfsAPIClient.DeleteAll(c.Ctx(), &types.Empty{})
				} else {
					_, err = c.PfsAPIClient.DeleteRepo(c.Ctx(), request)
				}
				return err
			})
			return grpcutil.ScrubGRPC(err)
		}),
	}
	deleteRepo.Flags().BoolVarP(&force, "force", "f", false, "remove the repo regardless of errors; use with care")
	deleteRepo.Flags().BoolVar(&all, "all", false, "remove all repos")
	shell.RegisterCompletionFunc(deleteRepo, shell.RepoCompletion)
	commands = append(commands, cmdutil.CreateAlias(deleteRepo, "delete repo"))

	commitDocs := &cobra.Command{
		Short: "Docs for commits.",
		Long: `Commits are atomic transactions on the content of a repo.

Creating a commit is a multistep process:
- start a new commit with 'start commit'
- write files to the commit via 'put file'
- finish the new commit with 'finish commit'

Commits that have been started but not finished are NOT durable storage.
Commits become reliable (and immutable) when they are finished.

Commits can be created with another commit as a parent.`,
	}
	commands = append(commands, cmdutil.CreateDocsAlias(commitDocs, "commit", " commit$"))

	var parent string
	startCommit := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch>",
		Short: "Start a new commit.",
		Long:  "Start a new commit with parent-commit as the parent on the given branch; if the branch does not exist, it will be created.",
		Example: `
# Start a commit in repo "test" on branch "master"
$ {{alias}} test@master

# Start a commit with "master" as the parent in repo "test", on a new branch "patch"; essentially a fork.
$ {{alias}} test@patch -p master

# Start a commit with XXX as the parent in repo "test" on the branch "fork"
$ {{alias}} test@fork -p XXX`,
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			branch, err := cmdutil.ParseBranch(args[0])
			if err != nil {
				return err
			}
			c, err := newClient("user")
			if err != nil {
				return err
			}
			defer c.Close()

			var parentCommit *pfs.Commit
			if parent != "" {
				// We don't know if the parent is a commit ID, branch, or ancestry, so
				// construct a string to parse.
				parentCommit, err = cmdutil.ParseCommit(fmt.Sprintf("%s@%s", branch.Repo, parent))
				if err != nil {
					return err
				}
			}

			var commit *pfs.Commit
			err = txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				var err error
				commit, err = c.PfsAPIClient.StartCommit(
					c.Ctx(),
					&pfs.StartCommitRequest{
						Branch:      branch,
						Parent:      parentCommit,
						Description: description,
					},
				)
				return err
			})
			if err == nil {
				fmt.Println(commit.ID)
			}
			return grpcutil.ScrubGRPC(err)
		}),
	}
	startCommit.Flags().StringVarP(&parent, "parent", "p", "", "The parent of the new commit, unneeded if branch is specified and you want to use the previous head of the branch as the parent.")
	startCommit.MarkFlagCustom("parent", "__pachctl_get_commit $(__parse_repo ${nouns[0]})")
	startCommit.Flags().StringVarP(&description, "message", "m", "", "A description of this commit's contents")
	startCommit.Flags().StringVar(&description, "description", "", "A description of this commit's contents (synonym for --message)")
	shell.RegisterCompletionFunc(startCommit, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(startCommit, "start commit"))

	finishCommit := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>",
		Short: "Finish a started commit.",
		Long:  "Finish a started commit. Commit-id must be a writeable commit.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			commit, err := cmdutil.ParseCommit(args[0])
			if err != nil {
				return err
			}
			c, err := newClient("user")
			if err != nil {
				return err
			}
			defer c.Close()

			err = txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				_, err = c.PfsAPIClient.FinishCommit(
					c.Ctx(),
					&pfs.FinishCommitRequest{
						Commit:      commit,
						Description: description,
						Force:       force,
					},
				)
				return err
			})
			return grpcutil.ScrubGRPC(err)
		}),
	}
	finishCommit.Flags().StringVarP(&description, "message", "m", "", "A description of this commit's contents (overwrites any existing commit description)")
	finishCommit.Flags().StringVar(&description, "description", "", "A description of this commit's contents (synonym for --message)")
	finishCommit.Flags().BoolVarP(&force, "force", "f", false, "finish the commit even if it has provenance, which could break jobs; prefer 'stop job'")
	shell.RegisterCompletionFunc(finishCommit, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(finishCommit, "finish commit"))

	inspectCommit := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>",
		Short: "Return info about a commit.",
		Long:  "Return info about a commit.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			commit, err := cmdutil.ParseCommit(args[0])
			if err != nil && uuid.IsUUIDWithoutDashes(args[0]) {
				return errors.New(`Use "list commit <id>" to see commits with a given ID across different repos`)
			} else if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			commitInfo, err := c.PfsAPIClient.InspectCommit(
				c.Ctx(),
				&pfs.InspectCommitRequest{
					Commit: commit,
					Wait:   pfs.CommitState_STARTED,
				})
			if err != nil {
				return grpcutil.ScrubGRPC(err)
			}
			if commitInfo == nil {
				return errors.Errorf("commit %s not found", commit.ID)
			}
			if raw {
				return cmdutil.Encoder(output, os.Stdout).EncodeProto(commitInfo)
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}
			ci := &pretty.PrintableCommitInfo{
				CommitInfo:     commitInfo,
				FullTimestamps: fullTimestamps,
			}
			return pretty.PrintDetailedCommitInfo(os.Stdout, ci)
		}),
	}
	inspectCommit.Flags().AddFlagSet(outputFlags)
	inspectCommit.Flags().AddFlagSet(timestampFlags)
	shell.RegisterCompletionFunc(inspectCommit, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(inspectCommit, "inspect commit"))

	var from string
	var number int64
	var originStr string
	var expand bool
	listCommit := &cobra.Command{
		Use:   "{{alias}} [<commit-id>|<repo>[@<branch-or-commit>]]",
		Short: "Return a list of commits.",
		Long:  "Return a list of commits, either across the entire pachyderm cluster or restricted to a single repo.",
		Example: `
# return all commits
$ {{alias}}

# return commits in repo "foo"
$ {{alias}} foo

# return all sub-commits in a commit
$ {{alias}} <commit-id>

# return commits in repo "foo" on branch "master"
$ {{alias}} foo@master

# return the last 20 commits in repo "foo" on branch "master"
$ {{alias}} foo@master -n 20

# return commits in repo "foo" on branch "master" since commit XXX
$ {{alias}} foo@master --from XXX`,
		Run: cmdutil.RunBoundedArgs(0, 1, func(args []string) (retErr error) {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			if !raw && output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			} else if all && originStr != "" {
				return errors.New("cannot specify both --all and --origin")
			}

			if len(args) == 0 {
				// Outputting all commitsets
				if originStr != "" {
					return errors.Errorf("cannot specify --origin when listing all commits")
				} else if from != "" {
					return errors.Errorf("cannot specify --from when listing all commits")
				}

				listCommitSetClient, err := c.PfsAPIClient.ListCommitSet(c.Ctx(), &pfs.ListCommitSetRequest{})
				if err != nil {
					return grpcutil.ScrubGRPC(err)
				}

				count := 0
				if !expand {
					if raw {
						e := cmdutil.Encoder(output, os.Stdout)
						return clientsdk.ForEachCommitSet(listCommitSetClient, func(commitSetInfo *pfs.CommitSetInfo) error {
							if err := e.EncodeProto(commitSetInfo); err != nil {
								return err
							}
							count++
							if number != 0 && count >= int(number) {
								return errutil.ErrBreak
							}
							return nil
						})
					}

					return pager.Page(noPager, os.Stdout, func(w io.Writer) error {
						writer := tabwriter.NewWriter(w, pretty.CommitSetHeader)
						if err := clientsdk.ForEachCommitSet(listCommitSetClient, func(commitSetInfo *pfs.CommitSetInfo) error {
							pretty.PrintCommitSetInfo(writer, commitSetInfo, fullTimestamps)
							count++
							if number != 0 && count >= int(number) {
								return errutil.ErrBreak
							}
							return nil
						}); err != nil {
							return err
						}
						return writer.Flush()
					})
				} else {
					if raw {
						e := cmdutil.Encoder(output, os.Stdout)
						return clientsdk.ForEachCommitSet(listCommitSetClient, func(commitSetInfo *pfs.CommitSetInfo) error {
							for _, commitInfo := range commitSetInfo.Commits {
								if err := e.EncodeProto(commitInfo); err != nil {
									return err
								}
								count++
								if number != 0 && count >= int(number) {
									return errutil.ErrBreak
								}
							}
							return nil
						})
					}

					return pager.Page(noPager, os.Stdout, func(w io.Writer) error {
						writer := tabwriter.NewWriter(w, pretty.CommitHeader)
						if err := clientsdk.ForEachCommitSet(listCommitSetClient, func(commitSetInfo *pfs.CommitSetInfo) error {
							for _, commitInfo := range commitSetInfo.Commits {
								pretty.PrintCommitInfo(writer, commitInfo, fullTimestamps)
								count++
								if number != 0 && count >= int(number) {
									return errutil.ErrBreak
								}
							}
							return nil
						}); err != nil {
							return err
						}
						return writer.Flush()
					})
				}
			} else if len(args) == 1 && uuid.IsUUIDWithoutDashes(args[0]) {
				// Outputting commits from one commitset
				if from != "" {
					return errors.Errorf("cannot specify --from when listing subcommits")
				} else if all {
					return errors.Errorf("cannot specify --all when listing subcommits")
				} else if originStr != "" {
					return errors.Errorf("cannot specify --origin when listing subcommits")
				}

				commitInfos, err := c.InspectCommitSet(args[0])
				if err != nil {
					return errors.Wrap(err, "error from InspectCommitSet")
				}

				if number != 0 && len(commitInfos) > int(number) {
					commitInfos = commitInfos[:number]
				}

				if raw {
					encoder := cmdutil.Encoder(output, os.Stdout)
					for _, commitInfo := range commitInfos {
						if err := encoder.EncodeProto(commitInfo); err != nil {
							return err
						}
					}
					return nil
				}

				return pager.Page(noPager, os.Stdout, func(w io.Writer) error {
					writer := tabwriter.NewWriter(w, pretty.CommitHeader)
					for _, commitInfo := range commitInfos {
						pretty.PrintCommitInfo(writer, commitInfo, fullTimestamps)
					}
					return writer.Flush()
				})
			} else {
				// Outputting filtered commits
				toCommit, err := cmdutil.ParseCommit(args[0])
				if err != nil {
					return err
				}

				repo := toCommit.Branch.Repo

				var fromCommit *pfs.Commit
				if from != "" {
					fromCommit = repo.NewCommit("", from)
				}

				if toCommit.ID == "" && toCommit.Branch.Name == "" {
					// just a repo
					toCommit = nil
				}

				origin, err := parseOriginKind(originStr)
				if err != nil {
					return err
				}

				listClient, err := c.PfsAPIClient.ListCommit(c.Ctx(), &pfs.ListCommitRequest{
					Repo:       repo,
					From:       fromCommit,
					To:         toCommit,
					Number:     number,
					All:        all,
					OriginKind: origin,
				})
				if err != nil {
					return grpcutil.ScrubGRPC(err)
				}

				if raw {
					encoder := cmdutil.Encoder(output, os.Stdout)
					return clientsdk.ForEachCommit(listClient, func(ci *pfs.CommitInfo) error {
						return encoder.EncodeProto(ci)
					})
				}
				writer := tabwriter.NewWriter(os.Stdout, pretty.CommitHeader)
				if err := clientsdk.ForEachCommit(listClient, func(ci *pfs.CommitInfo) error {
					pretty.PrintCommitInfo(writer, ci, fullTimestamps)
					return nil
				}); err != nil {
					return grpcutil.ScrubGRPC(err)
				}
				return writer.Flush()
			}
		}),
	}
	listCommit.Flags().StringVarP(&from, "from", "f", "", "list all commits since this commit")
	listCommit.Flags().Int64VarP(&number, "number", "n", 0, "list only this many commits; if set to zero, list all commits")
	listCommit.MarkFlagCustom("from", "__pachctl_get_commit $(__parse_repo ${nouns[0]})")
	listCommit.Flags().BoolVar(&all, "all", false, "return all types of commits, including aliases")
	listCommit.Flags().BoolVarP(&expand, "expand", "x", false, "show one line for each sub-commmit and include more columns")
	listCommit.Flags().StringVar(&originStr, "origin", "", "only return commits of a specific type")
	listCommit.Flags().AddFlagSet(outputFlags)
	listCommit.Flags().AddFlagSet(timestampFlags)
	shell.RegisterCompletionFunc(listCommit, shell.RepoCompletion)
	commands = append(commands, cmdutil.CreateAlias(listCommit, "list commit"))

	waitCommit := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>",
		Short: "Wait for the specified commit to finish and return it.",
		Long:  "Wait for the specified commit to finish and return it.",
		Example: `
# wait for the commit foo@XXX to finish and return it
$ {{alias}} foo@XXX -b bar@baz`,
		Run: cmdutil.RunFixedArgs(1, func(args []string) (retErr error) {
			commit, err := cmdutil.ParseCommit(args[0])
			if err != nil {
				return err
			}

			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			commitInfo, err := c.WaitCommit(commit.Branch.Repo.Name, commit.Branch.Name, commit.ID)
			if err != nil {
				return err
			}

			if raw {
				return cmdutil.Encoder(output, os.Stdout).EncodeProto(commitInfo)
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}

			ci := &pretty.PrintableCommitInfo{
				CommitInfo:     commitInfo,
				FullTimestamps: fullTimestamps,
			}
			return pretty.PrintDetailedCommitInfo(os.Stdout, ci)
		}),
	}
	waitCommit.Flags().AddFlagSet(outputFlags)
	waitCommit.Flags().AddFlagSet(timestampFlags)
	commands = append(commands, cmdutil.CreateAlias(waitCommit, "wait commit"))

	var newCommits bool
	subscribeCommit := &cobra.Command{
		Use:   "{{alias}} <repo>[@<branch>]",
		Short: "Print commits as they are created (finished).",
		Long:  "Print commits as they are created in the specified repo and branch.  By default, all existing commits on the specified branch are returned first.  A commit is only considered 'created' when it's been finished.",
		Example: `
# subscribe to commits in repo "test" on branch "master"
$ {{alias}} test@master

# subscribe to commits in repo "test" on branch "master", but only since commit XXX.
$ {{alias}} test@master --from XXX

# subscribe to commits in repo "test" on branch "master", but only for new commits created from now on.
$ {{alias}} test@master --new`,
		Run: cmdutil.RunFixedArgs(1, func(args []string) (retErr error) {
			branch, err := cmdutil.ParseBranch(args[0])
			if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			var fromCommit *pfs.Commit
			if newCommits && from != "" {
				return errors.Errorf("--new and --from cannot be used together")
			} else if newCommits || from != "" {
				fromCommit = branch.NewCommit(from)
			}

			if all && originStr != "" {
				return errors.New("cannot specify both --all and --origin")
			}

			origin, err := parseOriginKind(originStr)
			if err != nil {
				return err
			}

			subscribeClient, err := c.PfsAPIClient.SubscribeCommit(c.Ctx(), &pfs.SubscribeCommitRequest{
				Repo:       branch.Repo,
				Branch:     branch.Name,
				From:       fromCommit,
				State:      pfs.CommitState_STARTED,
				All:        all,
				OriginKind: origin,
			})
			if err != nil {
				return grpcutil.ScrubGRPC(err)
			}

			if raw {
				encoder := cmdutil.Encoder(output, os.Stdout)
				return clientsdk.ForEachSubscribeCommit(subscribeClient, func(ci *pfs.CommitInfo) error {
					return encoder.EncodeProto(ci)
				})
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}

			w := tabwriter.NewWriter(os.Stdout, pretty.CommitHeader)
			defer func() {
				if err := w.Flush(); retErr == nil {
					retErr = err
				}
			}()
			if err := clientsdk.ForEachSubscribeCommit(subscribeClient, func(ci *pfs.CommitInfo) error {
				pretty.PrintCommitInfo(w, ci, fullTimestamps)
				return nil
			}); err != nil {
				return grpcutil.ScrubGRPC(err)
			}
			return err
		}),
	}
	subscribeCommit.Flags().StringVar(&from, "from", "", "subscribe to all commits since this commit")
	subscribeCommit.MarkFlagCustom("from", "__pachctl_get_commit $(__parse_repo ${nouns[0]})")
	subscribeCommit.Flags().BoolVar(&newCommits, "new", false, "subscribe to only new commits created from now on")
	subscribeCommit.Flags().BoolVar(&all, "all", false, "return all types of commits, including aliases")
	subscribeCommit.Flags().StringVar(&originStr, "origin", "", "only return commits of a specific type")
	subscribeCommit.Flags().AddFlagSet(outputFlags)
	subscribeCommit.Flags().AddFlagSet(timestampFlags)
	shell.RegisterCompletionFunc(subscribeCommit, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(subscribeCommit, "subscribe commit"))

	squashCommit := &cobra.Command{
		Use:   "{{alias}} <commit-id>",
		Short: "Squash the sub-commits of a commit.",
		Long: `Squash the sub-commits of a commit.  The data in the sub-commits will remain in their child commits.
The squash will fail if it includes a commit with no children`,

		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			return txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				return c.SquashCommitSet(args[0])
			})
		}),
	}
	shell.RegisterCompletionFunc(squashCommit, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(squashCommit, "squash commit"))

	deleteCommit := &cobra.Command{
		Use:   "{{alias}} <commit-id>",
		Short: "Delete the sub-commits of a commit.",
		Long: `Delete the sub-commits of a commit.  The data in the sub-commits will be lost.
This operation is only supported if none of the sub-commits have children.`,

		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			return txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				return c.DropCommitSet(args[0])
			})
		}),
	}
	shell.RegisterCompletionFunc(deleteCommit, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(deleteCommit, "delete commit"))

	branchDocs := &cobra.Command{
		Short: "Docs for branches.",
		Long: `A branch in Pachyderm records provenance relationships between data in different repos,
as well as being as an alias for a commit in its repo.

The branch reference will "float" to always refer to the latest commit on the
branch, known as the HEAD commit. All commits are on exactly one branch.

Any pachctl command that can take a commit, can take a branch name instead.`,
	}
	commands = append(commands, cmdutil.CreateDocsAlias(branchDocs, "branch", " branch$"))

	var branchProvenance cmdutil.RepeatedStringArg
	var head string
	trigger := &pfs.Trigger{}
	createBranch := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch>",
		Short: "Create a new branch, or update an existing branch, on a repo.",
		Long:  "Create a new branch, or update an existing branch, on a repo, starting a commit on the branch will also create it, so there's often no need to call this.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			branch, err := cmdutil.ParseBranch(args[0])
			if err != nil {
				return err
			}
			provenance, err := cmdutil.ParseBranches(branchProvenance)
			if err != nil {
				return err
			}
			if len(provenance) != 0 && trigger.Branch != "" {
				return errors.Errorf("cannot use provenance and triggers on the same branch")
			}
			if (trigger.CronSpec != "" || trigger.Size_ != "" || trigger.Commits != 0) && trigger.Branch == "" {
				return errors.Errorf("trigger condition specified without a branch to trigger on, specify a branch with --trigger")
			}
			if proto.Equal(trigger, &pfs.Trigger{}) {
				trigger = nil
			}
			var headCommit *pfs.Commit
			if head != "" {
				if strings.Contains(head, "@") {
					headCommit, err = cmdutil.ParseCommit(head)
					if err != nil {
						return err
					}
				} else {
					// treat head as the commitID or branch name
					headCommit = branch.Repo.NewCommit("", head)
				}
			}

			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			return txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				_, err := c.PfsAPIClient.CreateBranch(
					c.Ctx(),
					&pfs.CreateBranchRequest{
						Head:       headCommit,
						Branch:     branch,
						Provenance: provenance,
						Trigger:    trigger,
					})
				return grpcutil.ScrubGRPC(err)
			})
		}),
	}
	createBranch.Flags().VarP(&branchProvenance, "provenance", "p", "The provenance for the branch. format: <repo>@<branch>")
	createBranch.MarkFlagCustom("provenance", "__pachctl_get_repo_commit")
	createBranch.Flags().StringVarP(&head, "head", "", "", "The head of the newly created branch. Either pass the commit with format: <branch-or-commit>, or fully-qualified as <repo>@<branch>=<id>")
	createBranch.MarkFlagCustom("head", "__pachctl_get_commit $(__parse_repo ${nouns[0]})")
	createBranch.Flags().StringVarP(&trigger.Branch, "trigger", "t", "", "The branch to trigger this branch on.")
	createBranch.Flags().StringVar(&trigger.CronSpec, "trigger-cron", "", "The cron spec to use in triggering.")
	createBranch.Flags().StringVar(&trigger.Size_, "trigger-size", "", "The data size to use in triggering.")
	createBranch.Flags().Int64Var(&trigger.Commits, "trigger-commits", 0, "The number of commits to use in triggering.")
	createBranch.Flags().BoolVar(&trigger.All, "trigger-all", false, "Only trigger when all conditions are met, rather than when any are met.")
	commands = append(commands, cmdutil.CreateAlias(createBranch, "create branch"))

	inspectBranch := &cobra.Command{
		Use:   "{{alias}}  <repo>@<branch>",
		Short: "Return info about a branch.",
		Long:  "Return info about a branch.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()
			branch, err := cmdutil.ParseBranch(args[0])
			if err != nil {
				return err
			}

			branchInfo, err := c.PfsAPIClient.InspectBranch(c.Ctx(), &pfs.InspectBranchRequest{Branch: branch})
			if err != nil {
				return grpcutil.ScrubGRPC(err)
			}
			if branchInfo == nil {
				return errors.Errorf("branch %s not found", args[0])
			}
			if raw {
				return cmdutil.Encoder(output, os.Stdout).EncodeProto(branchInfo)
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}

			return pretty.PrintDetailedBranchInfo(branchInfo)
		}),
	}
	inspectBranch.Flags().AddFlagSet(outputFlags)
	inspectBranch.Flags().AddFlagSet(timestampFlags)
	shell.RegisterCompletionFunc(inspectBranch, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(inspectBranch, "inspect branch"))

	listBranch := &cobra.Command{
		Use:   "{{alias}} <repo>",
		Short: "Return all branches on a repo.",
		Long:  "Return all branches on a repo.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()
			branchClient, err := c.PfsAPIClient.ListBranch(c.Ctx(), &pfs.ListBranchRequest{Repo: cmdutil.ParseRepo(args[0])})
			if err != nil {
				return grpcutil.ScrubGRPC(err)
			}

			if raw {
				encoder := cmdutil.Encoder(output, os.Stdout)
				err := clientsdk.ForEachBranchInfo(branchClient, func(branch *pfs.BranchInfo) error {
					return encoder.EncodeProto(branch)
				})
				return grpcutil.ScrubGRPC(err)
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}

			writer := tabwriter.NewWriter(os.Stdout, pretty.BranchHeader)
			if err := clientsdk.ForEachBranchInfo(branchClient, func(branch *pfs.BranchInfo) error {
				pretty.PrintBranch(writer, branch)
				return nil
			}); err != nil {
				return grpcutil.ScrubGRPC(err)
			}
			return writer.Flush()
		}),
	}
	listBranch.Flags().AddFlagSet(outputFlags)
	shell.RegisterCompletionFunc(listBranch, shell.RepoCompletion)
	commands = append(commands, cmdutil.CreateAlias(listBranch, "list branch"))

	deleteBranch := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch>",
		Short: "Delete a branch",
		Long:  "Delete a branch, while leaving the commits intact",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			branch, err := cmdutil.ParseBranch(args[0])
			if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			return txncmds.WithActiveTransaction(c, func(c *client.APIClient) error {
				_, err := c.PfsAPIClient.DeleteBranch(c.Ctx(), &pfs.DeleteBranchRequest{Branch: branch, Force: force})
				return err
			})
		}),
	}
	deleteBranch.Flags().BoolVarP(&force, "force", "f", false, "remove the branch regardless of errors; use with care")
	shell.RegisterCompletionFunc(deleteBranch, shell.BranchCompletion)
	commands = append(commands, cmdutil.CreateAlias(deleteBranch, "delete branch"))

	fileDocs := &cobra.Command{
		Short: "Docs for files.",
		Long: `Files are the lowest level data objects in Pachyderm.

Files can be of any type (e.g. csv, binary, images, etc) or size and can be
written to started (but not finished) commits with 'put file'. Files can be read
from commits with 'get file'.`,
	}
	commands = append(commands, cmdutil.CreateDocsAlias(fileDocs, "file", " file$"))

	var filePaths []string
	var inputFile string
	var recursive bool
	var parallelism int
	var appendFile bool
	var compress bool
	var enableProgress bool
	var fullPath bool
	putFile := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>[:<path/to/file>]",
		Short: "Put a file into the filesystem.",
		Long:  "Put a file into the filesystem.  This command supports a number of ways to insert data into PFS.",
		Example: `
# Put data from stdin as repo/branch/path:
$ echo "data" | {{alias}} repo@branch:/path

# Put data from stdin as repo/branch/path and start / finish a new commit on the branch.
$ echo "data" | {{alias}} -c repo@branch:/path

# Put a file from the local filesystem as repo/branch/path:
$ {{alias}} repo@branch:/path -f file

# Put a file from the local filesystem as repo/branch/file:
$ {{alias}} repo@branch -f file

# Put the contents of a directory as repo/branch/path/dir/file:
$ {{alias}} -r repo@branch:/path -f dir

# Put the contents of a directory as repo/branch/dir/file:
$ {{alias}} -r repo@branch -f dir

# Put the contents of a directory as repo/branch/file, i.e. put files at the top level:
$ {{alias}} -r repo@branch:/ -f dir

# Put the data from a URL as repo/branch/path:
$ {{alias}} repo@branch:/path -f http://host/path

# Put the data from a URL as repo/branch/path:
$ {{alias}} repo@branch -f http://host/path

# Put the data from an S3 bucket as repo/branch/s3_object:
$ {{alias}} repo@branch -r -f s3://my_bucket

# Put several files or URLs that are listed in file.
# Files and URLs should be newline delimited.
$ {{alias}} repo@branch -i file

# Put several files or URLs that are listed at URL.
# NOTE this URL can reference local files, so it could cause you to put sensitive
# files into your Pachyderm cluster.
$ {{alias}} repo@branch -i http://host/path`,
		Run: cmdutil.RunFixedArgs(1, func(args []string) (retErr error) {
			if !enableProgress {
				progress.Disable()
			}
			file, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			opts := []client.Option{client.WithMaxConcurrentStreams(parallelism)}
			if compress {
				opts = append(opts, client.WithGZIPCompression())
			}
			c, err := newClient("user", opts...)
			if err != nil {
				return err
			}
			defer c.Close()
			defer progress.Wait()

			// TODO: Rethink put file parallelism for 2.0.
			// Doing parallel uploads at the file level for small files will be bad, but we still want a clear way to parallelize large file uploads.
			//limiter := limit.New(int(parallelism))
			var sources []string
			if inputFile != "" {
				// User has provided a file listing sources, one per line. Read sources
				var r io.Reader
				if inputFile == "-" {
					r = os.Stdin
				} else if url, err := url.Parse(inputFile); err == nil && url.Scheme != "" {
					resp, err := http.Get(url.String())
					if err != nil {
						return err
					}
					defer func() {
						if err := resp.Body.Close(); err != nil && retErr == nil {
							retErr = err
						}
					}()
					r = resp.Body
				} else {
					inputFile, err := os.Open(inputFile)
					if err != nil {
						return err
					}
					defer func() {
						if err := inputFile.Close(); err != nil && retErr == nil {
							retErr = err
						}
					}()
					r = inputFile
				}
				// scan line by line
				scanner := bufio.NewScanner(r)
				for scanner.Scan() {
					if filePath := scanner.Text(); filePath != "" {
						sources = append(sources, filePath)
					}
				}
			} else {
				// User has provided a single source
				sources = filePaths
			}

			return c.WithModifyFileClient(file.Commit, func(mf client.ModifyFile) error {
				for _, source := range sources {
					source := source
					if file.Path == "" {
						// The user has not specified a path so we use source as path.
						if source == "-" {
							return errors.Errorf("must specify filename when reading data from stdin")
						}
						target := source
						if !fullPath {
							target = filepath.Base(source)
						}
						if err := putFileHelper(mf, joinPaths("", target), source, recursive, appendFile); err != nil {
							return err
						}
					} else if len(sources) == 1 {
						// We have a single source and the user has specified a path,
						// we use the path and ignore source (in terms of naming the file).
						if err := putFileHelper(mf, file.Path, source, recursive, appendFile); err != nil {
							return err
						}
					} else {
						// We have multiple sources and the user has specified a path,
						// we use that path as a prefix for the filepaths.
						target := source
						if !fullPath {
							target = filepath.Base(source)
						}
						if err := putFileHelper(mf, joinPaths(file.Path, target), source, recursive, appendFile); err != nil {
							return err
						}
					}
				}
				return nil
			})
		}),
	}
	putFile.Flags().StringSliceVarP(&filePaths, "file", "f", []string{"-"}, "The file to be put, it can be a local file or a URL.")
	putFile.Flags().StringVarP(&inputFile, "input-file", "i", "", "Read filepaths or URLs from a file.  If - is used, paths are read from the standard input.")
	putFile.Flags().BoolVarP(&recursive, "recursive", "r", false, "Recursively put the files in a directory.")
	putFile.Flags().BoolVarP(&compress, "compress", "", false, "Compress data during upload. This parameter might help you upload your uncompressed data, such as CSV files, to Pachyderm faster. Use 'compress' with caution, because if your data is already compressed, this parameter might slow down the upload speed instead of increasing.")
	putFile.Flags().IntVarP(&parallelism, "parallelism", "p", DefaultParallelism, "The maximum number of files that can be uploaded in parallel.")
	putFile.Flags().BoolVarP(&appendFile, "append", "a", false, "Append to the existing content of the file, either from previous commits or previous calls to 'put file' within this commit.")
	putFile.Flags().BoolVar(&enableProgress, "progress", isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd()), "Print progress bars.")
	putFile.Flags().BoolVar(&fullPath, "full-path", false, "If true, use the entire path provided to -f as the target filename in PFS. By default only the base of the path is used.")
	shell.RegisterCompletionFunc(putFile,
		func(flag, text string, maxCompletions int64) ([]prompt.Suggest, shell.CacheFunc) {
			if flag == "-f" || flag == "--file" || flag == "-i" || flag == "input-file" {
				cs, cf := shell.FilesystemCompletion(flag, text, maxCompletions)
				return cs, shell.AndCacheFunc(cf, shell.SameFlag(flag))
			} else if flag == "" || flag == "-c" || flag == "--commit" || flag == "-o" || flag == "--append" {
				cs, cf := shell.FileCompletion(flag, text, maxCompletions)
				return cs, shell.AndCacheFunc(cf, shell.SameFlag(flag))
			}
			return nil, shell.SameFlag(flag)
		})
	commands = append(commands, cmdutil.CreateAlias(putFile, "put file"))

	copyFile := &cobra.Command{
		Use:   "{{alias}} <src-repo>@<src-branch-or-commit>:<src-path> <dst-repo>@<dst-branch-or-commit>:<dst-path>",
		Short: "Copy files between pfs paths.",
		Long:  "Copy files between pfs paths.",
		Run: cmdutil.RunFixedArgs(2, func(args []string) (retErr error) {
			srcFile, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			destFile, err := cmdutil.ParseFile(args[1])
			if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user", client.WithMaxConcurrentStreams(parallelism))
			if err != nil {
				return err
			}
			defer c.Close()

			var opts []client.CopyFileOption
			if appendFile {
				opts = append(opts, client.WithAppendCopyFile())
			}
			return c.CopyFile(
				destFile.Commit, destFile.Path,
				srcFile.Commit, srcFile.Path,
				opts...,
			)
		}),
	}
	copyFile.Flags().BoolVarP(&appendFile, "append", "a", false, "Append to the existing content of the file, either from previous commits or previous calls to 'put file' within this commit.")
	shell.RegisterCompletionFunc(copyFile, shell.FileCompletion)
	commands = append(commands, cmdutil.CreateAlias(copyFile, "copy file"))

	var outputPath string
	var offsetBytes int64
	var retry bool
	getFile := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>:<path/in/pfs>",
		Short: "Return the contents of a file.",
		Long:  "Return the contents of a file.",
		Example: `
# get file "XXX" on branch "master" in repo "foo"
$ {{alias}} foo@master:XXX

# get file "XXX" in the parent of the current head of branch "master"
# in repo "foo"
$ {{alias}} foo@master^:XXX

# get file "XXX" in the grandparent of the current head of branch "master"
# in repo "foo"
$ {{alias}} foo@master^2:XXX

# get file "test[].txt" on branch "master" in repo "foo"
# the path is interpreted as a glob pattern: quote and protect regex characters
$ {{alias}} 'foo@master:/test\[\].txt'`,
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			if !enableProgress {
				progress.Disable()
			}
			file, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			c, err := newClient("user")
			if err != nil {
				return err
			}
			defer c.Close()
			defer progress.Wait()
			// TODO: Decide what progress should look like in the recursive case. The files are downloaded in a batch in 2.x.
			if recursive {
				if outputPath == "" {
					return errors.Errorf("an output path needs to be specified when using the --recursive flag")
				}
				// Check that the path matches one directory / file.
				fi, err := c.InspectFile(file.Commit, file.Path)
				if err != nil {
					return err
				}
				r, err := c.GetFileTAR(file.Commit, file.Path)
				if err != nil {
					return err
				}
				return tarutil.Import(outputPath, r, func(hdr *tar.Header) error {
					hdr.Name = strings.TrimPrefix(hdr.Name, fi.File.Path)
					return nil
				})
			}
			var w io.Writer
			// If an output path is given, print the output to stdout
			if outputPath == "" {
				w = os.Stdout
			} else {
				if url, err := url.Parse(outputPath); err == nil && url.Scheme != "" {
					return c.GetFileURL(file.Commit, file.Path, url.String())
				}
				fi, err := c.InspectFile(file.Commit, file.Path)
				if err != nil {
					return err
				}
				var f *progress.File
				if ofi, err := os.Stat(outputPath); retry && err == nil {
					// when retrying, just write the unwritten bytes
					if offsetBytes == 0 {
						offsetBytes = ofi.Size()
					}
					f, err = progress.OpenAppend(outputPath, int64(fi.SizeBytes)-offsetBytes)
					if err != nil {
						return err
					}
				} else {
					f, err = progress.Create(outputPath, int64(fi.SizeBytes)-offsetBytes)
					if err != nil {
						return err
					}
				}
				defer f.Close()
				w = f
			}
			if err := c.GetFile(file.Commit, file.Path, w); err != nil {
				return errors.Errorf("File %s not found. Command only supports file paths", file.Path)
			}
			return nil
		}),
	}
	getFile.Flags().BoolVarP(&recursive, "recursive", "r", false, "Recursively download a directory.")
	getFile.Flags().StringVarP(&outputPath, "output", "o", "", "The path where data will be downloaded.")
	getFile.Flags().BoolVar(&enableProgress, "progress", isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd()), "{true|false} Whether or not to print the progress bars.")
	getFile.Flags().Int64Var(&offsetBytes, "offset", 0, "The number of bytes in the file to skip ahead when reading.")
	getFile.Flags().BoolVar(&retry, "retry", false, "{true|false} Whether to append the missing bytes to an existing file. No-op if the file doesn't exist.")
	shell.RegisterCompletionFunc(getFile, shell.FileCompletion)
	commands = append(commands, cmdutil.CreateAlias(getFile, "get file"))

	inspectFile := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>:<path/in/pfs>",
		Short: "Return info about a file.",
		Long:  "Return info about a file.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			file, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()
			fileInfo, err := c.InspectFile(file.Commit, file.Path)
			if err != nil {
				return err
			}
			if fileInfo == nil {
				return errors.Errorf("file %s not found", file.Path)
			}
			if raw {
				return cmdutil.Encoder(output, os.Stdout).EncodeProto(fileInfo)
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}
			return pretty.PrintDetailedFileInfo(fileInfo)
		}),
	}
	inspectFile.Flags().AddFlagSet(outputFlags)
	shell.RegisterCompletionFunc(inspectFile, shell.FileCompletion)
	commands = append(commands, cmdutil.CreateAlias(inspectFile, "inspect file"))

	listFile := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>[:<path/in/pfs>]",
		Short: "Return the files in a directory.",
		Long:  "Return the files in a directory.",
		Example: `
# list top-level files on branch "master" in repo "foo"
$ {{alias}} foo@master

# list files under directory "dir" on branch "master" in repo "foo"
$ {{alias}} foo@master:dir

# list top-level files in the parent commit of the current head of "master"
# in repo "foo"
$ {{alias}} foo@master^

# list top-level files in the grandparent of the current head of "master"
# in repo "foo"
$ {{alias}} foo@master^2

# list file under directory "dir[1]" on branch "master" in repo "foo"
# the path is interpreted as a glob pattern: quote and protect regex characters
$ {{alias}} 'foo@master:dir\[1\]'`,
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			file, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()
			if raw {
				encoder := cmdutil.Encoder(output, os.Stdout)
				return c.ListFile(file.Commit, file.Path, func(fi *pfs.FileInfo) error {
					return encoder.EncodeProto(fi)
				})
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}
			header := pretty.FileHeader
			writer := tabwriter.NewWriter(os.Stdout, header)
			if err := c.ListFile(file.Commit, file.Path, func(fi *pfs.FileInfo) error {
				pretty.PrintFileInfo(writer, fi, fullTimestamps, false)
				return nil
			}); err != nil {
				return err
			}
			return writer.Flush()
		}),
	}
	listFile.Flags().AddFlagSet(outputFlags)
	listFile.Flags().AddFlagSet(timestampFlags)
	shell.RegisterCompletionFunc(listFile, shell.FileCompletion)
	commands = append(commands, cmdutil.CreateAlias(listFile, "list file"))

	globFile := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>:<pattern>",
		Short: "Return files that match a glob pattern in a commit.",
		Long:  "Return files that match a glob pattern in a commit (that is, match a glob pattern in a repo at the state represented by a commit). Glob patterns are documented [here](https://golang.org/pkg/path/filepath/#Match).",
		Example: `
# Return files in repo "foo" on branch "master" that start
# with the character "A".  Note how the double quotation marks around the
# parameter are necessary because otherwise your shell might interpret the "*".
$ {{alias}} "foo@master:A*"

# Return files in repo "foo" on branch "master" under directory "data".
$ {{alias}} "foo@master:data/*"`,
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			file, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()
			fileInfos, err := c.GlobFileAll(file.Commit, file.Path)
			if err != nil {
				return err
			}
			if raw {
				encoder := cmdutil.Encoder(output, os.Stdout)
				for _, fileInfo := range fileInfos {
					if err := encoder.EncodeProto(fileInfo); err != nil {
						return err
					}
				}
				return nil
			} else if output != "" {
				return errors.New("cannot set --output (-o) without --raw")
			}
			writer := tabwriter.NewWriter(os.Stdout, pretty.FileHeader)
			for _, fileInfo := range fileInfos {
				pretty.PrintFileInfo(writer, fileInfo, fullTimestamps, false)
			}
			return writer.Flush()
		}),
	}
	globFile.Flags().AddFlagSet(outputFlags)
	globFile.Flags().AddFlagSet(timestampFlags)
	shell.RegisterCompletionFunc(globFile, shell.FileCompletion)
	commands = append(commands, cmdutil.CreateAlias(globFile, "glob file"))

	var shallow bool
	var nameOnly bool
	var diffCmdArg string
	diffFile := &cobra.Command{
		Use:   "{{alias}} <new-repo>@<new-branch-or-commit>:<new-path> [<old-repo>@<old-branch-or-commit>:<old-path>]",
		Short: "Return a diff of two file trees stored in Pachyderm",
		Long:  "Return a diff of two file trees stored in Pachyderm",
		Example: `
# Return the diff of the file "path" of the repo "foo" between the head of the
# "master" branch and its parent.
$ {{alias}} foo@master:path

# Return the diff between the master branches of repos foo and bar at paths
# path1 and path2, respectively.
$ {{alias}} foo@master:path1 bar@master:path2`,
		Run: cmdutil.RunBoundedArgs(1, 2, func(args []string) error {
			newFile, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			oldFile := &pfs.File{}
			if len(args) == 2 {
				oldFile, err = cmdutil.ParseFile(args[1])
				if err != nil {
					return err
				}
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			return pager.Page(noPager, os.Stdout, func(w io.Writer) (retErr error) {
				var writer *tabwriter.Writer
				if nameOnly {
					writer = tabwriter.NewWriter(w, pretty.DiffFileHeader)
					defer func() {
						if err := writer.Flush(); err != nil && retErr == nil {
							retErr = err
						}
					}()
				}

				newFiles, oldFiles, err := c.DiffFileAll(
					newFile.Commit, newFile.Path,
					oldFile.Commit, oldFile.Path,
					shallow,
				)
				if err != nil {
					return err
				}
				diffCmd := diffCommand(diffCmdArg)
				return forEachDiffFile(newFiles, oldFiles, func(nFI, oFI *pfs.FileInfo) error {
					if nameOnly {
						if nFI != nil {
							pretty.PrintDiffFileInfo(writer, true, nFI, fullTimestamps)
						}
						if oFI != nil {
							pretty.PrintDiffFileInfo(writer, false, oFI, fullTimestamps)
						}
						return nil
					}
					nPath, oPath := "/dev/null", "/dev/null"
					if nFI != nil && nFI.FileType == pfs.FileType_FILE {
						nPath, err = dlFile(c, nFI.File)
						if err != nil {
							return err
						}
						defer func() {
							if err := os.RemoveAll(nPath); err != nil && retErr == nil {
								retErr = err
							}
						}()
					}
					if oFI != nil && oFI.FileType == pfs.FileType_FILE {
						oPath, err = dlFile(c, oFI.File)
						defer func() {
							if err := os.RemoveAll(oPath); err != nil && retErr == nil {
								retErr = err
							}
						}()
					}
					cmd := exec.Command(diffCmd[0], append(diffCmd[1:], oPath, nPath)...)
					cmd.Stdout = w
					cmd.Stderr = os.Stderr
					// Diff returns exit code 1 when it finds differences
					// between the files, so we catch it.
					if err := cmd.Run(); err != nil && cmd.ProcessState.ExitCode() != 1 {
						return err
					}
					return nil
				})
			})
		}),
	}
	diffFile.Flags().BoolVarP(&shallow, "shallow", "s", false, "Don't descend into sub directories.")
	diffFile.Flags().BoolVar(&nameOnly, "name-only", false, "Show only the names of changed files.")
	diffFile.Flags().StringVar(&diffCmdArg, "diff-command", "", "Use a program other than git to diff files.")
	diffFile.Flags().AddFlagSet(timestampFlags)
	diffFile.Flags().AddFlagSet(pagerFlags)
	shell.RegisterCompletionFunc(diffFile, shell.FileCompletion)
	commands = append(commands, cmdutil.CreateAlias(diffFile, "diff file"))

	deleteFile := &cobra.Command{
		Use:   "{{alias}} <repo>@<branch-or-commit>:<path/in/pfs>",
		Short: "Delete a file.",
		Long:  "Delete a file.",
		Run: cmdutil.RunFixedArgs(1, func(args []string) error {
			file, err := cmdutil.ParseFile(args[0])
			if err != nil {
				return err
			}
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()

			var opts []client.DeleteFileOption
			if recursive {
				opts = append(opts, client.WithRecursiveDeleteFile())
			}
			return c.DeleteFile(file.Commit, file.Path, opts...)
		}),
	}
	deleteFile.Flags().BoolVarP(&recursive, "recursive", "r", false, "Recursively delete the files in a directory.")
	shell.RegisterCompletionFunc(deleteFile, shell.FileCompletion)
	commands = append(commands, cmdutil.CreateAlias(deleteFile, "delete file"))

	objectDocs := &cobra.Command{
		Short: "Docs for objects.",
		Long: `Objects are content-addressed blobs of data that are directly stored in the backend object store.

Objects are a low-level resource and should not be accessed directly by most users.`,
	}
	commands = append(commands, cmdutil.CreateDocsAlias(objectDocs, "object", " object$"))

	var fix bool
	fsck := &cobra.Command{
		Use:   "{{alias}}",
		Short: "Run a file system consistency check on pfs.",
		Long:  "Run a file system consistency check on the pachyderm file system, ensuring the correct provenance relationships are satisfied.",
		Run: cmdutil.RunFixedArgs(0, func(args []string) error {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer c.Close()
			errors := false
			if err = c.Fsck(fix, func(resp *pfs.FsckResponse) error {
				if resp.Error != "" {
					errors = true
					fmt.Printf("Error: %s\n", resp.Error)
				} else {
					fmt.Printf("Fix applied: %v", resp.Fix)
				}
				return nil
			}); err != nil {
				return err
			}
			if !errors {
				fmt.Println("No errors found.")
			}
			return nil
		}),
	}
	fsck.Flags().BoolVarP(&fix, "fix", "f", false, "Attempt to fix as many issues as possible.")
	commands = append(commands, cmdutil.CreateAlias(fsck, "fsck"))

	var branchStr string
	var seed int64
	runLoadTest := &cobra.Command{
		Use:     "{{alias}} <spec-file>",
		Short:   "Run a PFS load test.",
		Long:    "Run a PFS load test.",
		Example: pfsload.LoadSpecification,
		Run: cmdutil.RunBoundedArgs(0, 1, func(args []string) (retErr error) {
			c, err := client.NewOnUserMachine("user")
			if err != nil {
				return err
			}
			defer func() {
				if err := c.Close(); retErr == nil {
					retErr = err
				}
			}()
			if len(args) == 0 {
				resp, err := c.PfsAPIClient.RunLoadTestDefault(c.Ctx(), &types.Empty{})
				if err != nil {
					return err
				}
				fmt.Println(resp.Spec)
				resp.Spec = ""
				if err := cmdutil.Encoder(output, os.Stdout).EncodeProto(resp); err != nil {
					return err
				}
				fmt.Println()
				return nil
			}
			return filepath.Walk(args[0], func(file string, fi os.FileInfo, err error) error {
				if err != nil {
					return err
				}
				if fi.IsDir() {
					return nil
				}
				spec, err := ioutil.ReadFile(file)
				if err != nil {
					return err
				}
				var branch *pfs.Branch
				if branchStr != "" {
					branch, err = cmdutil.ParseBranch(branchStr)
					if err != nil {
						return err
					}
				}
				resp, err := c.PfsAPIClient.RunLoadTest(c.Ctx(), &pfs.RunLoadTestRequest{
					Spec:   string(spec),
					Branch: branch,
					Seed:   seed,
				})
				if err != nil {
					return err
				}
				fmt.Println(resp.Spec)
				resp.Spec = ""
				if err := cmdutil.Encoder(output, os.Stdout).EncodeProto(resp); err != nil {
					return err
				}
				fmt.Println()
				return nil
			})
		}),
	}
	runLoadTest.Flags().StringVarP(&branchStr, "branch", "b", "", "The branch to use for generating the load.")
	runLoadTest.Flags().Int64VarP(&seed, "seed", "s", 0, "The seed to use for generating the load.")
	commands = append(commands, cmdutil.CreateAlias(runLoadTest, "run pfs-load-test"))

	// Add the mount commands (which aren't available on Windows, so they're in
	// their own file)
	commands = append(commands, mountCmds()...)

	return commands
}

func putFileHelper(mf client.ModifyFile, path, source string, recursive, appendFile bool) (retErr error) {
	// Resolve the path and convert to unix path in case we're on windows.
	path = filepath.ToSlash(filepath.Clean(path))
	var opts []client.PutFileOption
	if appendFile {
		opts = append(opts, client.WithAppendPutFile())
	}
	// try parsing the filename as a url, if it is one do a PutFileURL
	if url, err := url.Parse(source); err == nil && url.Scheme != "" {
		return mf.PutFileURL(path, url.String(), recursive, opts...)
	}
	if source == "-" {
		if recursive {
			return errors.New("cannot set -r and read from stdin (must also set -f or -i)")
		}
		stdin := progress.Stdin()
		defer stdin.Finish()
		return mf.PutFile(path, stdin, opts...)
	}
	// Resolve the source and convert to unix path in case we're on windows.
	source = filepath.ToSlash(filepath.Clean(source))
	if recursive {
		return filepath.Walk(source, func(filePath string, info os.FileInfo, err error) error {
			// file doesn't exist
			if info == nil {
				return errors.Errorf("%s doesn't exist", filePath)
			}
			if info.IsDir() {
				return nil
			}
			childDest := filepath.Join(path, strings.TrimPrefix(filePath, source))
			// don't do a second recursive 'put file', just put the one file at
			// filePath into childDest, and then this walk loop will go on to the
			// next one
			return putFileHelper(mf, childDest, filePath, false, appendFile)
		})
	}
	f, err := progress.Open(source)
	if err != nil {
		return err
	}
	defer func() {
		if err := f.Close(); retErr == nil {
			retErr = err
		}
	}()
	return mf.PutFile(path, f, opts...)
}

func joinPaths(prefix, filePath string) string {
	if url, err := url.Parse(filePath); err == nil && url.Scheme != "" {
		if url.Scheme == "pfs" {
			// pfs paths are of the form pfs://host/repo/branch/path we don't
			// want to prefix every file with host/repo so we remove those
			splitPath := strings.Split(strings.TrimPrefix(url.Path, "/"), "/")
			if len(splitPath) < 3 {
				return prefix
			}
			return filepath.Join(append([]string{prefix}, splitPath[2:]...)...)
		}
		return filepath.Join(prefix, strings.TrimPrefix(url.Path, "/"))
	}
	return filepath.Join(prefix, filePath)
}

func dlFile(pachClient *client.APIClient, f *pfs.File) (_ string, retErr error) {
	tempDir := filepath.Join(os.TempDir(), filepath.Dir(f.Path))
	if err := os.MkdirAll(tempDir, 0777); err != nil {
		return "", err
	}
	file, err := ioutil.TempFile(tempDir, filepath.Base(f.Path+"_"))
	if err != nil {
		return "", err
	}
	defer func() {
		if err := file.Close(); err != nil && retErr == nil {
			retErr = err
		}
	}()
	if err := pachClient.GetFile(f.Commit, f.Path, file); err != nil {
		return "", err
	}
	return file.Name(), nil
}

func diffCommand(cmdArg string) []string {
	if cmdArg != "" {
		return strings.Fields(cmdArg)
	}
	_, err := exec.LookPath("git")
	if err == nil {
		return []string{"git", "-c", "color.ui=always", "--no-pager", "diff", "--no-index"}
	}
	return []string{"diff"}
}

func forEachDiffFile(newFiles, oldFiles []*pfs.FileInfo, f func(newFile, oldFile *pfs.FileInfo) error) error {
	nI, oI := 0, 0
	for {
		if nI == len(newFiles) && oI == len(oldFiles) {
			return nil
		}
		var oFI *pfs.FileInfo
		var nFI *pfs.FileInfo
		switch {
		case oI == len(oldFiles) || (nI < len(newFiles) && newFiles[nI].File.Path < oldFiles[oI].File.Path):
			nFI = newFiles[nI]
			nI++
		case nI == len(newFiles) || (oI < len(oldFiles) && oldFiles[oI].File.Path < newFiles[nI].File.Path):
			oFI = oldFiles[oI]
			oI++
		case newFiles[nI].File.Path == oldFiles[oI].File.Path:
			nFI = newFiles[nI]
			nI++
			oFI = oldFiles[oI]
			oI++
		}
		if err := f(nFI, oFI); err != nil {
			if errors.Is(err, errutil.ErrBreak) {
				return nil
			}
			return err
		}
	}
}

func newClient(name string, options ...client.Option) (*client.APIClient, error) {
	if inWorkerStr, ok := os.LookupEnv("PACH_IN_WORKER"); ok {
		inWorker, err := strconv.ParseBool(inWorkerStr)
		if err != nil {
			return nil, errors.Wrap(err, "couldn't parse PACH_IN_WORKER")
		}
		if inWorker {
			return client.NewInWorker(options...)
		}
	}
	return client.NewOnUserMachine(name, options...)
}

func parseOriginKind(input string) (pfs.OriginKind, error) {
	if input == "" {
		return pfs.OriginKind_ORIGIN_KIND_UNKNOWN, nil
	}

	result := pfs.OriginKind(pfs.OriginKind_value[strings.ToUpper(input)])
	if result == pfs.OriginKind_ORIGIN_KIND_UNKNOWN {
		names := []string{}
		for name, value := range pfs.OriginKind_value {
			if pfs.OriginKind(value) != pfs.OriginKind_ORIGIN_KIND_UNKNOWN {
				names = append(names, name)
			}
		}
		return pfs.OriginKind_ORIGIN_KIND_UNKNOWN, errors.Errorf("unknown commit origin type '%s', must be one of: %s", input, strings.Join(names, ", "))
	}

	return result, nil
}


text:
@interface MMUITextView : UITextView
{
    _Bool isDictationPlaceholderShow;
}

@property(nonatomic) _Bool isDictationPlaceholderShow; // @synthesize isDictationPlaceholderShow;
- (void)removeDictationResultPlaceholder:(id)arg1 willInsertResult:(_Bool)arg2;
- (id)insertDictationResultPlaceholder;
- (void)dictationRecordingDidEnd;
- (void)dictationRecognitionFailed;

@end


text:
package city.restaurant.eric.gui;

import city.restaurant.eric.EricWaiterRole;
import city.restaurant.eric.interfaces.EricCustomer;
import gui.Gui;

import java.awt.*;
import java.util.ArrayList;

import javax.swing.ImageIcon;

public class EricWaiterGui implements Gui
{
	// ---------------------------------- DATA ----------------------------------

	// RestDims used for positions of stuff (unchanging):
	private ArrayList<RestDim> TABLES = new ArrayList<RestDim>();
	private RestDim FRONT_DESK;
	private RestDim OUTSIDE;
	private RestDim IDLE_LOCATION;
	private RestDim COOK;
	private RestDim REVOLVING_STAND;
	private RestDim CASHIER;
	// RestDims used for positions of stuff (variable):
	private RestDim _position;
	private RestDim _destination;
	private boolean _goingSomewhere = false; // implies that _agent will be expecting the msgReachedDestination() message and that the food being carried needs to be reset to none.

	// String for what food item to display.
	private String _carrying = null;

	// Correspondence:
    private EricWaiterRole _role = null;
    // private RestaurantGui _restaurantGui; //TODO implement a system to appropriately replace this

    ImageIcon a = new ImageIcon(this.getClass().getResource("/image/restaurant/NormalWaiter.png"));
    Image normal = a.getImage();
    int xGap = 17;
    int yGap = 27;

    // -------------------------------- CONSTRUCTOR -----------------------------
    public EricWaiterGui(EricWaiterRole role)
    {
        _role = role;

        // Initialize values:
        // Unchanging:
        TABLES.add(new RestDim(EricAnimationConstants.TABLE0_POSX - EricAnimationConstants.PERSON_WIDTH, EricAnimationConstants.TABLE0_POSY - EricAnimationConstants.PERSON_HEIGHT));
        TABLES.add(new RestDim(EricAnimationConstants.TABLE1_POSX - EricAnimationConstants.PERSON_WIDTH, EricAnimationConstants.TABLE1_POSY - EricAnimationConstants.PERSON_HEIGHT));
        TABLES.add(new RestDim(EricAnimationConstants.TABLE2_POSX - EricAnimationConstants.PERSON_WIDTH, EricAnimationConstants.TABLE2_POSY - EricAnimationConstants.PERSON_HEIGHT));
        FRONT_DESK = new RestDim(EricAnimationConstants.FRONTDESK_X + EricAnimationConstants.PERSON_WIDTH, EricAnimationConstants.FRONTDESK_Y - EricAnimationConstants.PERSON_HEIGHT);
        OUTSIDE = new RestDim(EricAnimationConstants.OUTSIDE_X, EricAnimationConstants.OUTSIDE_Y);
        IDLE_LOCATION = new RestDim(EricAnimationConstants.NEXT_WAITER_X, EricAnimationConstants.NEXT_WAITER_Y);
        EricAnimationConstants.updateNextWaiter();
        COOK = new RestDim(EricAnimationConstants.COOK_POSX, EricAnimationConstants.COOK_POSY - EricAnimationConstants.PERSON_HEIGHT);
        REVOLVING_STAND = new RestDim(EricAnimationConstants.REVOLVING_STAND_POSX, EricAnimationConstants.REVOLVING_STAND_POSY- EricAnimationConstants.PERSON_HEIGHT);
        CASHIER = new RestDim(EricAnimationConstants.CASHIER_POSX, EricAnimationConstants.CASHIER_POSY - EricAnimationConstants.PERSON_HEIGHT);
        // Variable:
        _position = new RestDim(OUTSIDE);
        _destination = new RestDim(IDLE_LOCATION);
    }

    // --------------------------------- PROPERTIES & MESSAGES ----------------------------------------
    // public void setRestGui(RestaurantGui rg) { _restaurantGui = rg; }
    public EricWaiterRole agent() { return _role; }
    public int getXPosition() { return _position.x; }
    public int getYPosition() { return _position.y; }
    public boolean isPresent() { return true; }
    public boolean atDestination() { return _position.equals(_destination); }
    public boolean wantsBreak() { return _role.wantsBreak(); }
    public boolean onBreak() { return _role.onBreak(); }
    public void msgBreaksOver() // from RestaurantGui
    {
    	_role.msgBreaksOver();
    }
    public void msgWantsABreak() // from WaiterAgent
    {
    	_role.msgWantABreak();
    }

    // ---------------------------------- COMMANDS --------------------------------------------

    // Makes the waiter go to the front desk, but does not notify anyone when he gets there; i.e. this function assumes that no other code is waiting for him to get there, so this motion may be safely intercepted.
    public void doGoIdle()
    {
    	_goingSomewhere = false;
    	_destination.set(IDLE_LOCATION);
    }

    public void doBringCustomerToTable(EricCustomer customer, int tableNumber)
    {
    	doGoToTable(tableNumber);

    	// Hack (sorta) to pass the coordinates of the table to the CustomerGui (there might be a better way to do this)
    	customer.gui().tableIsHere(
    			TABLES.get(tableNumber).x + EricAnimationConstants.PERSON_WIDTH ,
    			TABLES.get(tableNumber).y + EricAnimationConstants.PERSON_HEIGHT
    			);
    }

    public void doGoToTable(int tableNumber)
    {
    	_destination.set(TABLES.get(tableNumber));
    	_goingSomewhere = true;
    }

    public void doGoToFrontDesk()
    {
        _destination.set(FRONT_DESK);
    	_goingSomewhere = true;
    }

    public void doGoToCook()
    {
    	_destination.set(COOK);
    	_goingSomewhere = true;
    }

    public void doGoToRevolvingStand()
    {
    	_destination.set(REVOLVING_STAND);
    	_goingSomewhere = true;
    }

    public void doTakeOrderToCook(String choice)
    {
    	if(choice != null) {
    		_carrying = choice.substring(0, ((choice.length() > 1) ? 2 : 1) ) + "?";
    	}
    	doGoToCook();
    }

    public void doTakeOrderToRevolvingStand(String choice)
    {
    	if(choice != null) {
    		_carrying = choice.substring(0, ((choice.length() > 1) ? 2 : 1) ) + "?";
    	}
    	doGoToRevolvingStand();
    }

    public void doDeliverFood(int tableNumber, String choice)
    {
    	if(choice != null) {
    		_carrying = choice.substring(0, ((choice.length() > 1) ? 2 : 1) );
    	}

    	doGoToTable(tableNumber);
    }

    public void doGoToCashier()
    {
    	_destination.set(CASHIER);
    	_goingSomewhere = true;
    }

    public void doBringCheckToCustomer(EricCustomer customer, int tableNumber)
    {
    	doGoToTable(tableNumber);

    	// Hack (sorta) to pass the coordinates of the table to the CustomerGui (there might be a better way to do this)
    	customer.gui().cashierIsHere(
    			CASHIER.x ,
    			CASHIER.y - EricAnimationConstants.PERSON_HEIGHT
    			);
    }

    public void doCleanTable(int tableNumber)
    {
    	doGoToTable(tableNumber);
    	// will add cleaning animation here, possibly
    }

    public void doNoBreak()
    {
    	// _restaurantGui.notGoingOnBreak(this);
    	// don't need to go idle unless we replace the break location to be different from the idle location
    }

    public void doGoOnBreak()
    {
    	// _restaurantGui.goingOnBreak(this);
    	doGoIdle(); // might change to going to other coordinates
    }

    public void doBackToWork()
    {
    	// _restaurantGui.goingBackToWork(this);
    	doGoIdle();
    }

    // -------------------------------------- METHODS -------------------------------------

    public void updatePosition()
    {
        if (_position.x < _destination.x) _position.x++;
        else if (_position.x > _destination.x) _position.x--;

        if (_position.y < _destination.y) _position.y++;
        else if (_position.y > _destination.y) _position.y--;

        // Check to see of the position changed and the new position is equal to the destination.
        if (atDestination() && _goingSomewhere)
        {
           _role.msgReachedDestination();
           _goingSomewhere = false;
           _carrying = null;
        }
    }

    public void draw(Graphics2D g)
    {
    	g.drawImage(normal, _position.x, _position.y, xGap, yGap, null);

        if(_carrying != null)
        {
        	g.setFont(EricAnimationConstants.FONT);
        	g.setColor(Color.BLACK);
        	g.drawString(_carrying,
        			_position.x + EricAnimationConstants.PERSON_WIDTH,
        			_position.y + EricAnimationConstants.PERSON_HEIGHT
        			);
        }
    }
}


text:
test repository for vagrant usage

this is just to test that vagrant works