blob: b98894ec58464ac5b4df3db80792c8668dd09b8c [file] [log] [blame]
Paul Sokolovskyb639ce22016-04-29 00:17:11 +03001/*
2 * This file is part of the MicroPython project, http://micropython.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2013-2016 Damien P. George
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26
27#include <stdio.h>
28
29#include "lib/utils/pyhelp.h"
30
31STATIC const char *help_text =
32"Welcome to MicroPython!\n"
33"\n"
34"For online docs please visit http://docs.micropython.org/en/latest/esp8266/ .\n"
35"To get diagnostic information to include in bug reports, execute 'import port_diag'.\n"
36"\n"
37"Control commands:\n"
38" CTRL-A -- on a blank line, enter raw REPL mode\n"
39" CTRL-B -- on a blank line, enter normal REPL mode\n"
40" CTRL-C -- interrupt a running program\n"
41" CTRL-D -- on a blank line, do a soft reset of the board\n"
42" CTRL-E -- on a blank line, enter paste mode\n"
43"\n"
44"For further help on a specific object, type help(obj)\n"
45;
46
47STATIC mp_obj_t builtin_help(uint n_args, const mp_obj_t *args) {
48 if (n_args == 0) {
49 // print a general help message
50 printf("%s", help_text);
51
52 } else {
53 // try to print something sensible about the given object
54 pyhelp_print_obj(args[0]);
55 }
56
57 return mp_const_none;
58}
59MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_help_obj, 0, 1, builtin_help);