monotone

monotone Mtn Source Tree

Root/src/commands.hh

1// Copyright (C) 2002 Graydon Hoare <graydon@pobox.com>
2//
3// This program is made available under the GNU GPL version 2.0 or
4// greater. See the accompanying file COPYING for details.
5//
6// This program is distributed WITHOUT ANY WARRANTY; without even the
7// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8// PURPOSE.
9
10#ifndef __COMMANDS_HH__
11#define __COMMANDS_HH__
12
13#include "vector.hh"
14#include "options.hh"
15class app_state;
16class utf8;
17
18// this defines a global function which processes command-line-like things,
19// possibly from the command line and possibly internal scripting if we ever
20// bind tcl or lua or something in here
21
22namespace commands {
23 typedef std::vector< utf8 > command_id;
24 class command;
25 class automate;
26
27 command_id make_command_id(std::string const & path);
28 void explain_usage(command_id const & cmd, bool show_hidden, std::ostream & out);
29 command_id complete_command(args_vector const & args);
30 void remove_command_name_from_args(command_id const & ident,
31 args_vector & args,
32 size_t invisible_length = 1);
33 void reapply_options(app_state & app,
34 command const * cmd,
35 command_id const & cmd_ident,
36 command const * subcmd = 0,
37 command_id const & subcmd_full_ident = command_id(),
38 size_t subcmd_invisible_length = 1,
39 args_vector const & subcmd_cmdline = args_vector(),
40 std::vector<std::pair<std::string, std::string> >
41 const * const separate_params = 0);
42 void process(app_state & app, command_id const & ident,
43 args_vector const & args);
44 options::options_type command_options(command_id const & ident);
45};
46
47struct usage
48{
49 usage(commands::command_id const & w) : which(w) {}
50 commands::command_id which;
51};
52
53#endif
54
55// Local Variables:
56// mode: C++
57// fill-column: 76
58// c-file-style: "gnu"
59// indent-tabs-mode: nil
60// End:
61// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status