我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用click.BOOL。
def d_option(f): return click.option( '--detach', '-d', default=False, type=click.BOOL, is_flag=True, help='Run container in background and print container ID' )(f)
def all_option(f): return click.option( '--all', '-a', default=False, type=click.BOOL, is_flag=True, help='Show all containers (default shows just running)' )(f)
def force_option(f): return click.option( '--force', '-f', default=False, type=click.BOOL, is_flag=True, help='Force the removal of a running container (uses SIGKILL)' )(f)
def force_option_clean(f): return click.option( '--force', '-f', default=True, type=click.BOOL, is_flag=True, help='Force the removal of a running container (uses SIGKILL)' )(f)
def test_bool_type(self): class Option(BooleanOption): metadata = 'name' cli = ['--name'] click_option = ClickObjectOption(Option) self.assertEqual(click_option.type, click.BOOL)