Skip to content

Commit 072771c

Browse files
committed
Initial version
1 parent 32fc185 commit 072771c

File tree

5 files changed

+86
-1
lines changed

5 files changed

+86
-1
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
6+
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.
7+
8+
## Unreleased
9+
10+
## [v0.1.0] - 2021-09-27
11+
### Added
12+
- Basic functionality.

CHANGELOG.zh.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# 更新日志
2+
3+
本文格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
4+
本项目参照语义化版本规则 [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
5+
6+
声明:参照上述常用的规则不代表本项目及其维护者了解、支持或承认任何上述文档的作者、维护者的任何观点。
7+
8+
## 未发布
9+
10+
## [v0.1.0] - 2021-09-27
11+
### 新增 Added
12+
- 实现基本的功能。

README.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
11
# sqldiffer
2-
A wrapper of SQLite `sqldiff` util for use with `git diff`
2+
A wrapper of SQLite `sqldiff` util for use with `git diff`.
3+
4+
# Build
5+
6+
This repo is a Nimble package with some code written in
7+
[Nim](https://nim-lang.org).
8+
9+
To build it, simply set up your Nim environment (by `choosenim` or manual
10+
installation) and treat it as a usual Nimble package like:
11+
```
12+
nimble build
13+
```
14+
15+
Then install it into your `$(PATH)` use something like:
16+
```
17+
install sqldiffer /usr/local/bin
18+
```
19+
20+
# Usage
21+
22+
To use it as a external differ for `git diff`, you may edit your `gitconfig` and
23+
`gitattributes` following the instructions in their `man` pages after placing
24+
the tool in your `$(PATH)`.

sqldiffer.nimble

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Package
2+
3+
version = "0.1.0"
4+
author = "Chen (Kina)"
5+
description = "Wrapper of SQLite `sqldiff` for use with `git diff`"
6+
license = "MIT"
7+
srcDir = "src"
8+
bin = @["sqldiffer"]
9+
10+
11+
# Dependencies
12+
13+
requires "nim >= 1.4.8"

src/sqldiffer.nim

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import std/exitprocs
2+
import os
3+
import parseopt
4+
5+
var p = initOptParser()
6+
block:
7+
p.next()
8+
if p.kind != cmdArgument: break
9+
# First arg: path
10+
echo "Path: ", p.key
11+
p.next()
12+
if p.kind != cmdArgument: break
13+
# 2nd arg: old file
14+
let oldFile = p.key
15+
p.next()
16+
if p.kind != cmdArgument: break
17+
p.next()
18+
if p.kind != cmdArgument: break
19+
# 5th arg: old file
20+
p.next()
21+
if p.kind != cmdArgument: break
22+
let newFile = p.key
23+
let cmd = quoteShellCommand(["sqldiff", oldFile, newFile])
24+
echo cmd
25+
let resl = cmd.execShellCmd()
26+
setProgramResult resl

0 commit comments

Comments
 (0)