You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
757 B
32 lines
757 B
4 years ago
|
var touch = require("../touch")
|
||
|
, fs = require("fs")
|
||
|
, path = require("path")
|
||
|
, nopt = require("nopt")
|
||
|
, types = { atime: Boolean
|
||
|
, mtime: Boolean
|
||
|
, time: Date
|
||
|
, ref: path
|
||
|
, nocreate: Boolean
|
||
|
, force: Boolean }
|
||
|
, shorthands = { a: "--atime"
|
||
|
, m: "--mtime"
|
||
|
, r: "--ref"
|
||
|
, t: "--time"
|
||
|
, c: "--nocreate"
|
||
|
, f: "--force" }
|
||
|
|
||
|
var options = nopt(types, shorthands)
|
||
|
|
||
|
var files = options.argv.remain
|
||
|
delete options.argv
|
||
|
|
||
|
files.forEach(function (file) {
|
||
|
touch(file, options, function (er) {
|
||
|
if (er) {
|
||
|
console.error("bad touch!")
|
||
|
throw er
|
||
|
}
|
||
|
console.error(file, fs.statSync(file))
|
||
|
})
|
||
|
})
|