-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·101 lines (83 loc) · 2.67 KB
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env node
var program = require('commander')
var pjson = require('./package.json')
var switchBranch = require('./lib/switch')
var merge = require('./lib/merge')
var createBranch = require('./lib/create')
var viewModified = require('./lib/viewModified')
var viewLog = require('./lib/viewLog')
var viewHistory = require('./lib/viewHistory')
var passthrough = require('./lib/passthrough')
var deleteBranches = require('./lib/deleteBranches')
var config = require('./lib/config')
var updateNotifier = require('update-notifier')
var blame = require('./lib/blame')
var utils = require('./lib/utils')
var notifier = updateNotifier({
packageName : pjson.name,
packageVersion : pjson.version
})
if (notifier.update) {
notifier.notify()
}
program
.version(pjson.version)
.command('create <branch> [msg]')
.description('Create & switch to <branch> with optional commit [msg]')
.action(createBranch)
program
.command('delete <msg>')
.description('Delete selected branches with commit <msg>')
.action(deleteBranches)
program
.command('switch')
.description('Switch current working copy to another branch (Default)')
.action(switchBranch)
program
.command('modified')
.option('-c, --commit [msg]', 'commit the changes to modified files with optional [msg]')
.description('View modified files in working directory (pretty svn status)')
.action(viewModified)
program
.command('log [file]')
.option('-l, --limit <max>', 'maximum number of log entries')
.description('View log entires (up until copy) for current working copy')
.action(viewLog)
program
.command('blame <file>')
.description('svn blame (with line numbers) for given file')
.action(blame)
program
.command('history')
.description('Shows history of all files changed in the current branch')
.action(viewHistory)
program
.command('merge')
.option('-i, --ignore-ancestry', 'disable merge tracking; diff nodes as if related')
.description('Merge current working copy with another branch')
.action(merge)
program
.command('config')
.option('-a, --add <project>', 'Add project <project>')
.option('-r, --remove <project>', 'Remove project <project>')
.description('Add or display project profile')
.action(config)
program
.command('*')
.description('Unrecognized commands are passed through to SVN as a subcommand')
.action(passthrough)
program.on('--help', function(){
console.log(' Subcommand help examples:')
console.log('')
console.log(' $ sven modified --help')
console.log(' $ sven config -h')
console.log('')
})
program.parse(process.argv)
if (program.args.length == 0) {
if (utils.isCwdSVN()) {
switchBranch()
} else {
program.help()
}
}