#ifndef _CLI_QUIT_COMMAND_H_
#define _CLI_QUIT_COMMAND_H_

#include <command/Command.h>
#include <environment/Environment.h>
#include <ast/Statement.h>

namespace cli {

class QuitCommand : public Command {
	std::shared_ptr < Statement > m_command;

public:
	QuitCommand ( std::shared_ptr < Statement > command ) : m_command ( std::move ( command ) ) {
	}

	Command::Result run ( Environment & environment ) const override {
		if ( m_command )
			environment.setResult ( m_command->translateAndEval ( nullptr, environment ) );

		return Command::Result::QUIT;
	}
};

} /* namespace cli */

#endif /* _CLI_QUIT_COMMAND_H_ */
