// $CS110/exams/FingerCommand.java
//
// Ethan Bolker, November 2001
//

import java.util.StringTokenizer;

/** 
 * Implement the Juno shell command 
 * <pre>
 *     finger user
 * </pre>
 *
 * @version 6
 */

public class FingerCommand extends ShellCommand 
{
    /**
     * Construct a FingerCommand object.
     */

    public FingerCommand() 
    {
	super("display information about a user", "username");
    }

    /**
     * Provide information about a User.
     *
     * @param args the remainder of the command line.
     * @param sh the current shell
     */

    public void doIt( StringTokenizer args, Shell sh )
    {
	String userName = args.nextToken();
	User user = sh.getSystem().lookupUser(userName);
	sh.getConsole().println(userName + "\t" + user.getRealName());
    }
}

