-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
Disclaimer: adopting these practices DO NOT mean that this repo and / or its maintainers know, agree or admit any of the opinions expressed by the composers / maintainers of these practices. | ||
|
||
## Unreleased | ||
|
||
## [v0.1.0] - 2021-09-27 | ||
### Added | ||
- Basic functionality. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 更新日志 | ||
|
||
本文格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/), | ||
本项目参照语义化版本规则 [Semantic Versioning](https://semver.org/spec/v2.0.0.html)。 | ||
|
||
声明:参照上述常用的规则不代表本项目及其维护者了解、支持或承认任何上述文档的作者、维护者的任何观点。 | ||
|
||
## 未发布 | ||
|
||
## [v0.1.0] - 2021-09-27 | ||
### 新增 Added | ||
- 实现基本的功能。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,24 @@ | ||
# sqldiffer | ||
A wrapper of SQLite `sqldiff` util for use with `git diff` | ||
A wrapper of SQLite `sqldiff` util for use with `git diff`. | ||
|
||
# Build | ||
|
||
This repo is a Nimble package with some code written in | ||
[Nim](https://nim-lang.org). | ||
|
||
To build it, simply set up your Nim environment (by `choosenim` or manual | ||
installation) and treat it as a usual Nimble package like: | ||
``` | ||
nimble build | ||
``` | ||
|
||
Then install it into your `$(PATH)` use something like: | ||
``` | ||
install sqldiffer /usr/local/bin | ||
``` | ||
|
||
# Usage | ||
|
||
To use it as a external differ for `git diff`, you may edit your `gitconfig` and | ||
`gitattributes` following the instructions in their `man` pages after placing | ||
the tool in your `$(PATH)`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Package | ||
|
||
version = "0.1.0" | ||
author = "Chen (Kina)" | ||
description = "Wrapper of SQLite `sqldiff` for use with `git diff`" | ||
license = "MIT" | ||
srcDir = "src" | ||
bin = @["sqldiffer"] | ||
|
||
|
||
# Dependencies | ||
|
||
requires "nim >= 1.4.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import std/exitprocs | ||
import os | ||
import parseopt | ||
|
||
var p = initOptParser() | ||
block: | ||
p.next() | ||
if p.kind != cmdArgument: break | ||
# First arg: path | ||
echo "Path: ", p.key | ||
p.next() | ||
if p.kind != cmdArgument: break | ||
# 2nd arg: old file | ||
let oldFile = p.key | ||
p.next() | ||
if p.kind != cmdArgument: break | ||
p.next() | ||
if p.kind != cmdArgument: break | ||
# 5th arg: old file | ||
p.next() | ||
if p.kind != cmdArgument: break | ||
let newFile = p.key | ||
let cmd = quoteShellCommand(["sqldiff", oldFile, newFile]) | ||
echo cmd | ||
let resl = cmd.execShellCmd() | ||
setProgramResult resl |