Skip to main content

A tool to merge source code files for software copyright application

Project description

代码合并工具

简介

该工具用于合并源代码文件,主要用于软件著作权申请。它支持多种编程语言,包括 JavaScript、Python、PHP 等,并且可以根据指定的文件扩展名进行过滤。

使用说明

命令行参数

  • -d--directory: 工作目录(默认为当前目录)
  • -s--start-file: 指定开始文件名(会在目录树中递归搜索)
  • -p--pages: 指定要提取的页面数(默认为 60)
  • -i--include: 指定要包含的文件扩展名(逗号分隔)
  • -e--exclude: 指定要排除的文件扩展名(逗号分隔)
  • -o--output: 指定输出文件名(默认为 out.txt
  • 通过 -x 或 --exclude-dirs 参数指定要排除的目录,多个目录用逗号分隔。

默认行为

  • 如果不指定开始文件名,工具会在目录树中递归搜索以下文件名:login.vueapp.pyindex.jsindex.phpindex.html
  • 如果不指定要包含的文件扩展名,工具会包含所有文件
  • 如果不指定要排除的文件扩展名,工具会排除以下文件扩展名:.lock.out.yaml.txt.md.csv.gitignore.sh.bat.xml.yml.json.png.jpg.jpeg.gif.bmp.ico.db.sqlite.bin.exe.dll.so.dylib,'.git'

工作流程

  1. 根据指定的目录和开始文件名,工具会在目录树中递归搜索开始文件
  2. 根据指定的文件扩展名,工具会过滤出要包含的文件
  3. 工具会合并过滤出的文件,并根据指定的页面数进行截取
  4. 工具会将合并后的代码保存到指定的输出文件中

注意事项

  • 请确保指定的目录和开始文件名正确
  • 请确保指定的文件扩展名正确
  • 请确保指定的页面数合理
  • 请确保输出文件名正确

安装方法

用pip 安装

python -m pip install merge_code

源码安装

git clone https://github.com/songyi1999/merge_code.git
cd merge_code
python -m pip install -e .

使用示例

merge_code -d /path/to/directory 

cd /path/to/directory
merge_code

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merge_code-0.2.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

merge_code-0.2.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file merge_code-0.2.3.tar.gz.

File metadata

  • Download URL: merge_code-0.2.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.5

File hashes

Hashes for merge_code-0.2.3.tar.gz
Algorithm Hash digest
SHA256 4540c2b61a752ecdd576c85cf9fbec9d24507ea4d3b7dd7edd811f2ef48e151f
MD5 e104be2ea68eb8a3169b7f5c1190157c
BLAKE2b-256 3ed859f5c0f2e34180997a7b39937216ca3d3b2b1f4fae65dd07fcf528b8b859

See more details on using hashes here.

File details

Details for the file merge_code-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: merge_code-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.5

File hashes

Hashes for merge_code-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d11c2b40fb152df5112b257d3b5b730f3f8ea05551821b981144b0ff792a50f5
MD5 4820b30da2240d07d172f18f7cb6a4a5
BLAKE2b-256 d315e4d4741aabcfd88e16eb0b1a5297f9a833f7842763b14f3af3d0feb28bd1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page