MCPcopy
hub / github.com/celery/celery / main

Function main

docs/changelog_formatter.py:77–126  ·  view source on GitHub ↗
(source, dest, clipboard)

Source from the content-addressed store, hash-verified

75 help="Read input from clipboard explicitly.",
76)
77def main(source, dest, clipboard):
78 # Determine the source of input
79 if clipboard or (not source and not sys.stdin.isatty()):
80 # Read from clipboard
81 lines = read_from_clipboard()
82 elif source:
83 # Read from specified file
84 lines = read_changes_file(source)
85 else:
86 # Default: read from clipboard
87 lines = read_from_clipboard()
88
89 output_lines = []
90 for line in lines:
91 output_line = process_line(line)
92 if output_line == "STOP_PROCESSING":
93 break
94 if output_line:
95 output_lines.append(output_line)
96
97 output_text = "\n".join(output_lines)
98
99 # Prepare the header
100 version = "x.y.z"
101 underline = "=" * len(version)
102
103 header = f"""
104.. _version-{version}:
105
106{version}
107{underline}
108
109:release-date: <YYYY-MM-DD>
110:release-by: <FULL NAME>
111
112What&#x27;s Changed
113~~~~~~~~~~~~~~
114"""
115
116 # Combine header and output
117 final_output = header + output_text
118
119 # Write output to destination
120 if dest.name == "<stdout>":
121 print(Fore.GREEN + "Copy the following text to Changelog.rst:")
122 print(Fore.YELLOW + header)
123 print(Fore.CYAN + output_text)
124 else:
125 dest.write(final_output + "\n")
126 dest.close()
127
128
129if __name__ == "__main__":

Callers 1

Calls 7

read_from_clipboardFunction · 0.85
read_changes_fileFunction · 0.85
process_lineFunction · 0.85
isattyMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected