Exemple #1
0
 def _valid_command_argument(self):
     if bool(self.commit_msg_file) is bool(self.rev_range):
         raise InvalidCommandArgumentError(
             (
                 "One and only one argument is required for check command! "
                 "See 'cz check -h' for more information"
             )
         )
Exemple #2
0
 def _valid_command_argument(self):
     number_args_provided = (bool(self.commit_msg_file) +
                             bool(self.commit_msg) + bool(self.rev_range))
     if number_args_provided == 0 and not os.isatty(0):
         self.commit_msg: Optional[str] = sys.stdin.read()
     elif number_args_provided != 1:
         raise InvalidCommandArgumentError(
             ("One and only one argument is required for check command! "
              "See 'cz check -h' for more information"))
Exemple #3
0
 def _valid_command_argument(self):
     num_exclusive_args_provided = sum(
         arg is not None
         for arg in (self.commit_msg_file, self.commit_msg, self.rev_range)
     )
     if num_exclusive_args_provided == 0 and not os.isatty(0):
         self.commit_msg: Optional[str] = sys.stdin.read()
     elif num_exclusive_args_provided != 1:
         raise InvalidCommandArgumentError(
             (
                 "Only one of --rev-range, --message, and --commit-msg-file is permitted by check command! "
                 "See 'cz check -h' for more information"
             )
         )