コード例 #1
0
ファイル: dev.py プロジェクト: BigRep/OctoPrint
			def custom_prompt_for_config(context, no_input=False):
				cookiecutter_dict = dict()

				env = StrictEnvironment()

				for key, raw in context['cookiecutter'].items():
					if key in options:
						val = options[key]
					else:
						raw = raw if isinstance(raw, basestring) else str(raw)
						val = env.from_string(raw).render(cookiecutter=cookiecutter_dict)

						if not no_input:
							val = click.prompt(key, default=val)

					cookiecutter_dict[key] = val
				return cookiecutter_dict
コード例 #2
0
ファイル: dev.py プロジェクト: tinkercnc/OctoPrint
            def custom_prompt_for_config(context, no_input=False):
                cookiecutter_dict = {}

                env = StrictEnvironment()

                for key, raw in context["cookiecutter"].items():
                    if key in options:
                        val = options[key]
                    else:
                        if not isinstance(raw, str):
                            raw = str(raw)
                        val = env.from_string(raw).render(cookiecutter=cookiecutter_dict)

                        if not no_input:
                            val = click.prompt(key, default=val)

                    cookiecutter_dict[key] = val
                return cookiecutter_dict