Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
clzls committed Sep 27, 2021
1 parent 32fc185 commit 072771c
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
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.
12 changes: 12 additions & 0 deletions CHANGELOG.zh.md
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
- 实现基本的功能。
24 changes: 23 additions & 1 deletion README.md
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)`.
13 changes: 13 additions & 0 deletions sqldiffer.nimble
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"
26 changes: 26 additions & 0 deletions src/sqldiffer.nim
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

0 comments on commit 072771c

Please sign in to comment.