예제 #1
0
server_options = bulk_options([
    click.option("--host",
                 type=click.STRING,
                 callback=set_ctx_obj_option,
                 help="Specify the host address on which to bind the server."),
    click.option("--port",
                 type=click.INT,
                 callback=set_ctx_obj_option,
                 help="Specify the port on which to bind the server."),
    click.option(
        "-4",
        "--ipv4",
        "v4",
        is_flag=True,
        callback=set_ctx_obj_option,
        help=
        "Bind to IPv4 addresses only. Implies '--host 0.0.0.0'. Silently ignored if -6 is present."
    ),
    click.option(
        "-6",
        "--ipv6",
        "v6",
        is_flag=True,
        callback=set_ctx_obj_option,
        help=
        "Bind to IPv6 addresses only. Disables dual stack when binding to any v6 addresses. Silently ignored if -4 is present."
    ),
    click.option(
        "--logging",
        type=click.Path(),
        callback=set_ctx_obj_option,
        help="Specify the config file to use for configuring logging."),
    click.option("--iknowwhatimdoing",
                 "allow_root",
                 is_flag=True,
                 callback=set_ctx_obj_option,
                 help="Allow OctoPrint to run as user root."),
    click.option("--debug",
                 is_flag=True,
                 callback=set_ctx_obj_option,
                 help="Enable debug mode."),
    click.option("--ignore-blacklist",
                 "ignore_blacklist",
                 is_flag=True,
                 callback=set_ctx_obj_option,
                 help="Disable processing of the plugin blacklist.")
])
예제 #2
0
    baseurl = octoprint_client.build_base_url(https=https,
                                              httpuser=httpuser,
                                              httppass=httppass,
                                              host=host,
                                              port=port,
                                              prefix=prefix)

    return octoprint_client.Client(baseurl, apikey)


client_options = bulk_options([
    click.option("--apikey", "-a", type=click.STRING),
    click.option("--host", "-h", type=click.STRING),
    click.option("--port", "-p", type=click.INT),
    click.option("--httpuser", type=click.STRING),
    click.option("--httppass", type=click.STRING),
    click.option("--https", is_flag=True),
    click.option("--prefix", type=click.STRING)
])
"""Common options to configure an API client."""


@click.group()
def client_commands():
    pass


@client_commands.group("client",
                       context_settings=dict(ignore_unknown_options=True))
@client_options
예제 #3
0
파일: client.py 프로젝트: ByReaL/OctoPrint
	baseurl = octoprint_client.build_base_url(https=https,
	                                          httpuser=httpuser,
	                                          httppass=httppass,
	                                          host=host,
	                                          port=port,
	                                          prefix=prefix)

	return octoprint_client.Client(baseurl, apikey)


client_options = bulk_options([
	click.option("--apikey", "-a", type=click.STRING),
	click.option("--host", "-h", type=click.STRING),
	click.option("--port", "-p", type=click.INT),
	click.option("--httpuser", type=click.STRING),
	click.option("--httppass", type=click.STRING),
	click.option("--https", is_flag=True),
	click.option("--prefix", type=click.STRING)
])
"""Common options to configure an API client."""


@click.group()
def client_commands():
	pass


@client_commands.group("client", context_settings=dict(ignore_unknown_options=True))
@client_options
@click.pass_context
예제 #4
0

#~~ server options

server_options = bulk_options([
    click.option("--host",
                 type=click.STRING,
                 callback=set_ctx_obj_option,
                 help="Specify the host on which to bind the server."),
    click.option("--port",
                 type=click.INT,
                 callback=set_ctx_obj_option,
                 help="Specify the port on which to bind the server."),
    click.option(
        "--logging",
        type=click.Path(),
        callback=set_ctx_obj_option,
        help="Specify the config file to use for configuring logging."),
    click.option("--iknowwhatimdoing",
                 "allow_root",
                 is_flag=True,
                 callback=set_ctx_obj_option,
                 help="Allow OctoPrint to run as user root."),
    click.option("--debug",
                 is_flag=True,
                 callback=set_ctx_obj_option,
                 help="Enable debug mode.")
])
"""Decorator to add the options shared among the server commands: ``--host``, ``--port``,
   ``--logging``, ``--iknowwhatimdoing`` and ``--debug``."""

daemon_options = bulk_options([
예제 #5
0
파일: server.py 프로젝트: devdej/OctoPrint
		                          host=host,
		                          port=port,
		                          debug=debug,
		                          safe_mode=safe_mode,
		                          allow_root=allow_root,
		                          octoprint_daemon=octoprint_daemon)
		octoprint_server.run()

#~~ server options

server_options = bulk_options([
	click.option("--host", type=click.STRING, callback=set_ctx_obj_option,
	             help="Specify the host on which to bind the server."),
	click.option("--port", type=click.INT, callback=set_ctx_obj_option,
	             help="Specify the port on which to bind the server."),
	click.option("--logging", type=click.Path(), callback=set_ctx_obj_option,
	             help="Specify the config file to use for configuring logging."),
	click.option("--iknowwhatimdoing", "allow_root", is_flag=True, callback=set_ctx_obj_option,
	             help="Allow OctoPrint to run as user root."),
	click.option("--debug", is_flag=True, callback=set_ctx_obj_option,
	             help="Enable debug mode.")
])
"""Decorator to add the options shared among the server commands: ``--host``, ``--port``,
   ``--logging``, ``--iknowwhatimdoing`` and ``--debug``."""

daemon_options = bulk_options([
	click.option("--pid", type=click.Path(), default="/tmp/octoprint.pid", callback=set_ctx_obj_option,
	             help="Pidfile to use for daemonizing.")
])
"""Decorator to add the options for the daemon subcommand: ``--pid``."""

#~~ "octoprint serve" and "octoprint daemon" commands
예제 #6
0
파일: server.py 프로젝트: foosel/OctoPrint
		                          safe_mode=safe_mode,
		                          allow_root=allow_root,
		                          octoprint_daemon=octoprint_daemon)
		octoprint_server.run()

#~~ server options

server_options = bulk_options([
	click.option("--host", type=click.STRING, callback=set_ctx_obj_option,
	             help="Specify the host address on which to bind the server."),
	click.option("--port", type=click.INT, callback=set_ctx_obj_option,
	             help="Specify the port on which to bind the server."),
	click.option("-4", "--ipv4", "v4", is_flag=True, callback=set_ctx_obj_option,
	             help="Bind to IPv4 addresses only. Implies '--host 0.0.0.0'. Silently ignored if -6 is present."),
	click.option("-6", "--ipv6", "v6", is_flag=True, callback=set_ctx_obj_option,
	             help="Bind to IPv6 addresses only. Disables dual stack when binding to any v6 addresses. Silently ignored if -4 is present."),
	click.option("--logging", type=click.Path(), callback=set_ctx_obj_option,
	             help="Specify the config file to use for configuring logging."),
	click.option("--iknowwhatimdoing", "allow_root", is_flag=True, callback=set_ctx_obj_option,
	             help="Allow OctoPrint to run as user root."),
	click.option("--debug", is_flag=True, callback=set_ctx_obj_option,
	             help="Enable debug mode."),
	click.option("--ignore-blacklist", "ignore_blacklist", is_flag=True, callback=set_ctx_obj_option,
	             help="Disable processing of the plugin blacklist.")
])
"""Decorator to add the options shared among the server commands: ``--host``, ``--port``, ``-4``, ``-6``
   ``--logging``, ``--iknowwhatimdoing`` and ``--debug``."""

daemon_options = bulk_options([
	click.option("--pid", type=click.Path(), default="/tmp/octoprint.pid", callback=set_ctx_obj_option,
	             help="Pidfile to use for daemonizing.")
])
예제 #7
0
파일: server.py 프로젝트: BigRep/OctoPrint
		                          host=host,
		                          port=port,
		                          debug=debug,
		                          safe_mode=safe_mode,
		                          allow_root=allow_root,
		                          octoprint_daemon=octoprint_daemon)
		octoprint_server.run()

#~~ server options

server_options = bulk_options([
	click.option("--host", type=click.STRING,
	             help="Specify the host on which to bind the server."),
	click.option("--port", type=click.INT,
	             help="Specify the port on which to bind the server."),
	click.option("--logging", type=click.Path(),
	             help="Specify the config file to use for configuring logging."),
	click.option("--iknowwhatimdoing", "allow_root", is_flag=True,
	             help="Allow OctoPrint to run as user root."),
	click.option("--debug", is_flag=True, help="Enable debug mode.")
])
"""Decorator to add the options shared among the server commands: ``--host``, ``--port``,
   ``--logging``, ``--iknowwhatimdoing`` and ``--debug``."""

#~~ "octoprint serve" and "octoprint daemon" commands

@click.group()
@pass_octoprint_ctx
def server_commands(obj):
	pass
예제 #8
0
                                  allow_root=allow_root,
                                  octoprint_daemon=octoprint_daemon)
        octoprint_server.run()


#~~ server options

server_options = bulk_options([
    click.option("--host",
                 type=click.STRING,
                 help="Specify the host on which to bind the server."),
    click.option("--port",
                 type=click.INT,
                 help="Specify the port on which to bind the server."),
    click.option(
        "--logging",
        type=click.Path(),
        help="Specify the config file to use for configuring logging."),
    click.option("--iknowwhatimdoing",
                 "allow_root",
                 is_flag=True,
                 help="Allow OctoPrint to run as user root."),
    click.option("--debug", is_flag=True, help="Enable debug mode.")
])
"""Decorator to add the options shared among the server commands: ``--host``, ``--port``,
   ``--logging``, ``--iknowwhatimdoing`` and ``--debug``."""

#~~ "octoprint serve" and "octoprint daemon" commands


@click.group()