Base class for Copier subcommands.
| 115 | |
| 116 | |
| 117 | class _Subcommand(cli.Application): |
| 118 | """Base class for Copier subcommands.""" |
| 119 | |
| 120 | def __init__(self, executable: str | None = None) -> None: |
| 121 | self.data: AnyByStrDict = {} |
| 122 | super().__init__(executable) |
| 123 | |
| 124 | answers_file = cli.SwitchAttr( |
| 125 | ["-a", "--answers-file"], |
| 126 | default=None, |
| 127 | help=( |
| 128 | "Update using this path (relative to `destination_path`) " |
| 129 | "to find the answers file" |
| 130 | ), |
| 131 | ) |
| 132 | exclude = cli.SwitchAttr( |
| 133 | ["-x", "--exclude"], |
| 134 | str, |
| 135 | list=True, |
| 136 | help=( |
| 137 | "A name or shell-style pattern matching files or folders " |
| 138 | "that must not be copied" |
| 139 | ), |
| 140 | ) |
| 141 | vcs_ref = cli.SwitchAttr( |
| 142 | ["-r", "--vcs-ref"], |
| 143 | str, |
| 144 | help=( |
| 145 | "Git reference to checkout in `template_src`. " |
| 146 | "If you do not specify it, it will try to checkout the latest git tag, " |
| 147 | "as sorted using the PEP 440 algorithm. If you want to checkout always " |
| 148 | "the latest version, use `--vcs-ref=HEAD`. " |
| 149 | "Use the special value `:current:` to refer to the current reference " |
| 150 | "of the template if it already exists." |
| 151 | ), |
| 152 | ) |
| 153 | pretend = cli.Flag(["-n", "--pretend"], help="Run but do not make any changes") |
| 154 | skip = cli.SwitchAttr( |
| 155 | ["-s", "--skip"], |
| 156 | str, |
| 157 | list=True, |
| 158 | help="Skip specified files if they exist already", |
| 159 | ) |
| 160 | quiet = cli.Flag(["-q", "--quiet"], help="Suppress status output") |
| 161 | prereleases = cli.Flag( |
| 162 | ["-g", "--prereleases"], |
| 163 | help="Use prereleases to compare template VCS tags.", |
| 164 | ) |
| 165 | unsafe = cli.Flag( |
| 166 | ["--UNSAFE", "--trust"], |
| 167 | help=( |
| 168 | "Allow templates with unsafe features (Jinja extensions, migrations, tasks)" |
| 169 | ), |
| 170 | ) |
| 171 | skip_tasks = cli.Flag( |
| 172 | ["-T", "--skip-tasks"], |
| 173 | default=False, |
| 174 | help="Skip template tasks execution", |
nothing calls this directly
no outgoing calls
no test coverage detected