Compare text and show the difference with color.
Install
===============
```
pip install diffcolor
```
Useage
===============
show the help
```bash
python -m diffcolor
```
After that, diffcolor will read data from STDIN.
For more help, you can use the "-h" option.
So, the following test command
```bash
echo "Hello World\nHello Worll" | python -m diffcolor
```
It will output the following, the last "l" is different:
![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214247.png)
By default, diffcolor compare each character in each frame of the data. You can use the "-s" parameter to specify the delimiter, such as the space. This "-s" parameter can be used multiple times.
For example, the following command will compare the data frame using the space.
```bash
echo "Hello World\nHello Worll" | python -m diffcolor -s " "
```
It will output the following, the last word "Worll" is different:
![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214354.png)
By default, it splits data frames using line breaks(\n). But sometimes, we need a front end and a frame end to segment. We can use the "-b" parameter to specify the frame header and the "-e" parameter to specify the frame footer.
For example, the following command will splits the data frame begin with "[" and end with "]\n".
```bash
echo "[Hello World,\nI am Tom]\nThis is not a frame.\n[Hello Worll,\nI am Tim]" | python -m diffcolor -b="[" -e="]\n" -s=" "
```
It will output the following, the color of "This is not a frame." is gray, because it is not a frame:
![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214500.png)
We can use the "-i" option to ignore the none frame data.
```bash
echo "[Hello World,\nI am Tom]\nThis is not a frame.\n[Hello Worll,\nI am Tim]" | python -m diffcolor -b="[" -e="]\n" -s=" " -i
```
It will output the following:
![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214542.png)
We can use the "-f" option to handled output appended data as the file grows. This option is like "tail -f", often used to handle growing log files.
The colors define you can use "-v" option to show.
```bash
python -m diffcolor -v
```
![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214628.png)
[Click to view more information!](https://github.com/sintrb/diffcolor)
CHANGES
===============
0.0.1
- first version
Raw data
{
"_id": null,
"home_page": "https://github.com/sintrb/diffcolor/",
"name": "diffcolor",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "color, diff, comapre",
"author": "trb",
"author_email": "sintrb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9d/19/5c9e088b17100655948e4852a7c1810007fceecd6408901b89d417fa2f64/diffcolor-0.0.3.tar.gz",
"platform": null,
"description": "Compare text and show the difference with color.\n\nInstall\n===============\n```\n pip install diffcolor\n```\n\nUseage\n===============\nshow the help\n```bash\npython -m diffcolor\n```\n\nAfter that, diffcolor will read data from STDIN.\n\nFor more help, you can use the \"-h\" option.\n\nSo, the following test command\n```bash\necho \"Hello World\\nHello Worll\" | python -m diffcolor\n```\nIt will output the following, the last \"l\" is different:\n\n![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214247.png)\n\nBy default, diffcolor compare each character in each frame of the data. You can use the \"-s\" parameter to specify the delimiter, such as the space. This \"-s\" parameter can be used multiple times. \nFor example, the following command will compare the data frame using the space.\n\n```bash\necho \"Hello World\\nHello Worll\" | python -m diffcolor -s \" \"\n```\n\nIt will output the following, the last word \"Worll\" is different:\n\n![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214354.png)\n\nBy default, it splits data frames using line breaks(\\n). But sometimes, we need a front end and a frame end to segment. We can use the \"-b\" parameter to specify the frame header and the \"-e\" parameter to specify the frame footer.\n\nFor example, the following command will splits the data frame begin with \"[\" and end with \"]\\n\".\n\n```bash\necho \"[Hello World,\\nI am Tom]\\nThis is not a frame.\\n[Hello Worll,\\nI am Tim]\" | python -m diffcolor -b=\"[\" -e=\"]\\n\" -s=\" \"\n```\n\nIt will output the following, the color of \"This is not a frame.\" is gray, because it is not a frame:\n\n![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214500.png)\n\nWe can use the \"-i\" option to ignore the none frame data.\n\n```bash\necho \"[Hello World,\\nI am Tom]\\nThis is not a frame.\\n[Hello Worll,\\nI am Tim]\" | python -m diffcolor -b=\"[\" -e=\"]\\n\" -s=\" \" -i\n```\n\nIt will output the following:\n\n![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214542.png)\n\nWe can use the \"-f\" option to handled output appended data as the file grows. This option is like \"tail -f\", often used to handle growing log files.\n\nThe colors define you can use \"-v\" option to show.\n\n```bash\npython -m diffcolor -v\n```\n\n![](https://temp-static-qn.inruan.com/sin-imgs/WX20241001-214628.png)\n\n[Click to view more information!](https://github.com/sintrb/diffcolor)\n\n\nCHANGES\n===============\n0.0.1\n\n- first version",
"bugtrack_url": null,
"license": null,
"summary": "compare text and show the difference with color.",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/sintrb/diffcolor/"
},
"split_keywords": [
"color",
" diff",
" comapre"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9d195c9e088b17100655948e4852a7c1810007fceecd6408901b89d417fa2f64",
"md5": "6cbc9ef4265bc8096697c7692200e4ef",
"sha256": "be3d1e0e43976c924b441f7fca39f0bbef43278f89e3766271338513d040b537"
},
"downloads": -1,
"filename": "diffcolor-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "6cbc9ef4265bc8096697c7692200e4ef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4672,
"upload_time": "2024-10-01T13:56:36",
"upload_time_iso_8601": "2024-10-01T13:56:36.778861Z",
"url": "https://files.pythonhosted.org/packages/9d/19/5c9e088b17100655948e4852a7c1810007fceecd6408901b89d417fa2f64/diffcolor-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-01 13:56:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sintrb",
"github_project": "diffcolor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "diffcolor"
}