| 3165 | return name, opts, secondary_opts |
| 3166 | |
| 3167 | def add_to_parser(self, parser: _OptionParser, ctx: Context) -> None: |
| 3168 | if self.multiple: |
| 3169 | action = "append" |
| 3170 | elif self.count: |
| 3171 | action = "count" |
| 3172 | else: |
| 3173 | action = "store" |
| 3174 | |
| 3175 | if self.is_flag: |
| 3176 | action = f"{action}_const" |
| 3177 | |
| 3178 | if self.is_bool_flag and self.secondary_opts: |
| 3179 | parser.add_option( |
| 3180 | obj=self, opts=self.opts, dest=self.name, action=action, const=True |
| 3181 | ) |
| 3182 | parser.add_option( |
| 3183 | obj=self, |
| 3184 | opts=self.secondary_opts, |
| 3185 | dest=self.name, |
| 3186 | action=action, |
| 3187 | const=False, |
| 3188 | ) |
| 3189 | else: |
| 3190 | parser.add_option( |
| 3191 | obj=self, |
| 3192 | opts=self.opts, |
| 3193 | dest=self.name, |
| 3194 | action=action, |
| 3195 | const=self.flag_value, |
| 3196 | ) |
| 3197 | else: |
| 3198 | parser.add_option( |
| 3199 | obj=self, |
| 3200 | opts=self.opts, |
| 3201 | dest=self.name, |
| 3202 | action=action, |
| 3203 | nargs=self.nargs, |
| 3204 | ) |
| 3205 | |
| 3206 | def get_help_record(self, ctx: Context) -> tuple[str, str] | None: |
| 3207 | if self.hidden: |