package com.postgres.util.cmd;

import java.util.*;

class ArgCmd extends GenericCmd {
	private StringBuffer argDest = null;
	protected Object get(){
		return argDest;
	}
	protected ArgCmd(String argID, StringBuffer argDest){
		super(argID);
		this.argDest = argDest;
	}
	protected int set(String args[], int iThisIndex) throws Exception {
		if (args.length <= iThisIndex) {
			//System.out.println("args.length = " + args.length);
			//System.out.println("iThisIndex = " + iThisIndex);
			throw new Exception("Command line param "
								+ argID
								+ " must be followed by a string");
		}
		// -- We can't directly change the string, so truncate it and add
		// -- what we want.
		argDest.setLength(0);
		argDest.append(args[iThisIndex]);
		wasSet = true;
		return iThisIndex + 1;
	}
}
