{"id":28799350,"url":"https://github.com/deminimis/comment_destroyer","last_synced_at":"2026-05-06T11:33:21.492Z","repository":{"id":298980329,"uuid":"1001736765","full_name":"deminimis/Comment_Destroyer","owner":"deminimis","description":"A utility to strip comments from source code files, available in both a user-friendly GUI and a flexible command-line tool.","archived":false,"fork":false,"pushed_at":"2025-06-13T23:52:24.000Z","size":312,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T00:25:28.759Z","etag":null,"topics":["commenting","comments","linux","utility-application","windows"],"latest_commit_sha":null,"homepage":"https://github.com/deminimis/Comment_Destroyer","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deminimis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-13T23:21:08.000Z","updated_at":"2025-06-13T23:52:27.000Z","dependencies_parsed_at":"2025-06-14T00:35:39.015Z","dependency_job_id":null,"html_url":"https://github.com/deminimis/Comment_Destroyer","commit_stats":null,"previous_names":["deminimis/comment_destroyer"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/deminimis/Comment_Destroyer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deminimis%2FComment_Destroyer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deminimis%2FComment_Destroyer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deminimis%2FComment_Destroyer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deminimis%2FComment_Destroyer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deminimis","download_url":"https://codeload.github.com/deminimis/Comment_Destroyer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deminimis%2FComment_Destroyer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260499362,"owners_count":23018292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["commenting","comments","linux","utility-application","windows"],"created_at":"2025-06-18T06:06:09.523Z","updated_at":"2026-05-06T11:33:21.486Z","avatar_url":"https://github.com/deminimis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Comment Destroyer\n\n**A dependency-free utility to strip comments from source code files, available in both a user-friendly GUI and a command-line tool.**\n\nBuilt on: [Comment-Parser](https://github.com/jeanralphaviles/comment_parser)\n\nHave you ever needed to prepare a source code file for distribution, analysis, or simply to get a clean line count without comments? Comment Destroyer provides a simple, reliable solution to remove all comment types from a wide range of programming languages, ensuring that what's inside strings or other syntax isn't accidentally broken.\n\n---\n\n## 1. Graphical User Interface (GUI)\n\nFor users who prefer a visual interface, the `commentdestroyer.py` application offers a simple and safe workflow.\n\n![GUI Screenshot](https://github.com/deminimis/Comment_Destroyer/blob/main/assets/commentdestroyerscreenshot1.png)\n\n* **Easy File Selection:** Use the native Windows/macOS/Linux file browser to select one or multiple files at once.\n* **Multi-Language Support:** Mix and match different file types (e.g., `.py`, `.cpp`, `.js`) in a single batch. The tool automatically detects the language and applies the correct stripping rules.\n* **Safe Saving Options:**\n    * **Strip \u0026 Save As...:** The default, safe option that creates a new file with `.stripped` appended to the name, leaving your original file untouched.\n    * **Strip \u0026 Overwrite:** A powerful option to permanently modify the original file in place.\n* **Interactive Confirmation:** Before any files are modified, a confirmation dialog appears, giving you a final chance to review your choices.\n* **Stripping Control:** A checkbox in the confirmation dialog allows you to choose whether to **Preserve blank lines**, which is useful for maintaining line numbers for debugging or analysis.\n\n## 2. Command-Line Interface (CLI)\n\n* **Clear Arguments:** Use simple flags to control the output.\n    * `files`: A list of one or more files to process.\n    * `-o` or `--overwrite`: Overwrites the original files. Includes a safety confirmation prompt.\n    * `-p` or `--preserve-lines`: Keeps blank lines where comments were, preserving line numbers.\n* **Built-in Help:** Run with `--help` to see all options and examples.\n\n```bash\n# Example: Create new stripped files\npython commentdestroyer_cli.py my_code.cpp my_script.py\n\n# Example: Overwrite original files and preserve line numbers\npython commentdestroyer_cli.py main.java --overwrite --preserve-lines\n```\n\n## Technical Details\nThis tool was designed for robustness and portability, avoiding the pitfalls of simpler regex-based solutions.\n\n### Core Stripping Engine\nThe core logic is a dependency-free state machine that parses code character by character. It explicitly tracks its state to differentiate between being inside a multi-line comment, a single-line comment, a string literal (\"...\"), or a character literal ('...'). This approach correctly handles complex edge cases, such as comment-like syntax appearing within a string, which often cause naive regex strippers to fail.\n\n## Language Support and Extensibility\nThis tool supports a wide variety of programming languages by categorizing their comment syntax. The internal engine is highly extensible—to add a new language, you simply need to add its file extension to the appropriate category within the LANGUAGE_STYLE_MAP dictionary in the source code.\n\nThe table below details the currently supported languages and their comment styles.\n\n| Language     | File Extensions         | Comment Style                          |\n| ------------ | ----------------------- | -------------------------------------- |\n| C / C++      | .c, .h, .cpp, .hpp, .cc | // (single-line) and /* ... */ (block) |\n| Java         | .java                   | // (single-line) and /* ... */ (block) |\n| JavaScript   | .js, .mjs, .jsx         | // (single-line) and /* ... */ (block) |\n| TypeScript   | .ts, .tsx               | // (single-line) and /* ... */ (block) |\n| Go           | .go                     | // (single-line) and /* ... */ (block) |\n| Rust         | .rs                     | // (single-line) and /* ... */ (block) |\n| CSS          | .css                    | /* ... */ (block only)                 |\n| Python       | .py, .pyw               | # (single-line)                        |\n| Ruby         | .rb                     | # (single-line)                        |\n| Shell Script | .sh                     | # (single-line)                        |\n| HTML         | .html, .htm             | \u003c!-- ... --\u003e (block)                   |\n| XML          | .xml                    | \u003c!-- ... --\u003e (block)                   |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeminimis%2Fcomment_destroyer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeminimis%2Fcomment_destroyer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeminimis%2Fcomment_destroyer/lists"}