X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FExecutor.hh;h=ba4cdcec02de738128400f682b0b8565a8f81b05;hb=731a143df4de38d4c8b0a81121990951971cd858;hp=7538eff228fd9e68e788bd73515396149323c351;hpb=958bdb52c39fa39f4ef91cafd9628bcb4f85a03c;p=senf.git diff --git a/Utils/Console/Executor.hh b/Utils/Console/Executor.hh index 7538eff..ba4cdce 100644 --- a/Utils/Console/Executor.hh +++ b/Utils/Console/Executor.hh @@ -92,7 +92,9 @@ namespace console { ///< Execute command /**< Output will be written to \a output. Same as execute(). */ + GenericNode & getNode(ParseCommandInfo const & command); DirectoryNode & cwd() const; ///< Current working directory + void cwd(DirectoryNode & dir); ///< Change current directory std::string cwdPath() const; ///< Return pathname of current directory bool skipping() const; ///< \c true, if currently skipping a directory group @@ -108,16 +110,17 @@ namespace console { /**< 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). */ + automatically by the interactive console). */ Executor & autocomplete(bool v); ///< Set autocomplete status /**< \see autocomplete() */ + DirectoryNode & chroot() const; ///< Get root node /**< The root node defaults to senf::console::root(). If changed, all path references are relative to this node and objects outside that tree cannot be accessed. */ + Executor & chroot(DirectoryNode & node); ///< chroot into given directory /**< After this call, all path's are interpreted relative to \a node and only nodes in the tree rooted at \a node @@ -137,6 +140,7 @@ namespace console { void cd(ParseCommandInfo::TokensRange dir); void ls(std::ostream & output, ParseCommandInfo::TokensRange dir); + void lr(std::ostream & output, ParseCommandInfo::TokensRange dir); void pushd(ParseCommandInfo::TokensRange dir); void popd(); void exit(); @@ -147,8 +151,17 @@ namespace console { Path & dir); std::string complete(DirectoryNode & dir, std::string const & name); - struct InvalidPathException {}; - struct InvalidDirectoryException {}; + struct InvalidPathException { + std::string path; + InvalidPathException() : path() {} + InvalidPathException(std::string path_) : path(path_) {} + + }; + struct InvalidDirectoryException { + std::string path; + InvalidDirectoryException() : path() {} + InvalidDirectoryException(std::string path_) : path(path_) {} + }; struct InvalidCommandException {}; DirectoryNode::ptr root_; @@ -163,6 +176,8 @@ namespace console { bool autocomplete_; }; + void senf_console_format_value(DirectoryNode::ptr value, std::ostream & os); + }} ///////////////////////////////hh.e////////////////////////////////////////