X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Console%2FExecutor.hh;h=92a2dfe218bfd8c7dfe367294ade2b8094276aee;hb=1b1d76302a5d61e918ef71f1c8e11f80ac1262e2;hp=48d62ba251a0ff17039fb2a741d699086044dc60;hpb=9a782796586d1f6708e1baab64f2140c3c7972e8;p=senf.git diff --git a/Console/Executor.hh b/Console/Executor.hh index 48d62ba..92a2dfe 100644 --- a/Console/Executor.hh +++ b/Console/Executor.hh @@ -63,8 +63,6 @@ namespace console { /////////////////////////////////////////////////////////////////////////// // Types - typedef boost::iterator_range< ParseCommandInfo::argument_iterator> Arguments; - /// Thrown by built-in 'exit' command struct ExitException {}; @@ -77,17 +75,41 @@ namespace console { ///\} /////////////////////////////////////////////////////////////////////////// - void operator()(ParseCommandInfo const & command, std::ostream & output); + void execute(std::ostream & output, ParseCommandInfo const & command); + ///< Execute command + /**< Output will be written to \a output. + Same as operator()(). */ + + void operator()(std::ostream & output, ParseCommandInfo const & command); ///< Execute command - /**< Output will be written to \a output. */ + /**< Output will be written to \a output. + Same as execute(). */ DirectoryNode & cwd() const; ///< Current working directory + bool autocd() const; ///< Get current autocd status + /**< if autocd is enabled, specifying a directory name as + command will cd to that directory. Disabled by + default (but enabled automatically by the interactive + console). */ + Executor & autocd(bool v); ///< Set autocd status + /**< \see autocd() */ + + bool autocomplete() const; ///< Get current autocomplete status + /**< if autocomplete is enabled, path components which can + be uniquely completed will be completed + automatically. Disabled by default (but enabled + automatically by the interactive console) void + autocomplete(bool v). */ + + Executor & autocomplete(bool v); ///< Set autocomplete status + /**< \see autocomplete() */ + protected: private: GenericNode & traverseNode(ParseCommandInfo::argument_value_type const & path); + GenericNode & traverseCommand(ParseCommandInfo::CommandPathRange const & path); DirectoryNode & traverseDirectory(ParseCommandInfo::argument_value_type const & path); - CommandNode & traverseCommand(ParseCommandInfo::CommandPathRange const & path); struct InvalidPathException {}; struct InvalidDirectoryException {}; @@ -97,6 +119,9 @@ namespace console { DirectoryNode::weak_ptr oldCwd_; typedef std::vector DirStack; DirStack dirstack_; + + bool autocd_; + bool autocomplete_; };