package Customizer::CommandLine;

use strict qw(vars);
use vars qw(@ISA @EXPORT);

use File::Copy;
use Exporter;

use Input;
use Customizer::Base;
use Customizer::Item;

@ISA = qw(Customizer::Base);
@EXPORT = qw(attributes);

attributes qw();

sub Input($)
{
    my $self = shift;

    while (1){
	printf("*** %s ***\n", $self->name);
	print "0: quit\n";
	for (@{$self->content}){
	    print $_->AsSelect;
	}
	my $num = InputInteger("input number", 0);
	last if $num == 0;
	if ($_ = $self->content->[$num-1]){
	    $_->Input;
	} else {
	    print "no such number: $num\n";
	}
    }
}

sub Do ($)
{
    my $self = shift;

    $self->Read;
    $self->Input;
    if ($self->is_root){
	if (InputYN("Save?", 1)){
	    $self->Save;
	    print "saved.\n";
	} else {
	    print "quit.\n";
	}
    }
}
 
1;
