Skip to content

Commit

Permalink
Merge pull request tj#3 from overra/master
Browse files Browse the repository at this point in the history
Added CLI
  • Loading branch information
tj committed Aug 31, 2013
2 parents ea15d98 + 4f43456 commit 81bd962
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
47 changes: 47 additions & 0 deletions bin/gify
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env node
'use strict';

/**
* Module dependencies.
*/

var gify = require('../index'),
program = require('commander'),
pkg = require('../package'),
infile,
outfile,
options;

// CLI

program
.version(pkg.version)
.usage('[options] infile outfile')
.option('-w, --width [width]', 'max width [500]')
.option('-h, --height [height]', 'max height [none]')
.option('-d, --delay [delay]', 'delay between frames [auto]')
.option('-r, --rate [rate]', 'frame rate [10]')
.option('-s, --start [time]', 'start position in seconds or hh:mm:ss[.xxx] format [0]')
.option('-D, --duration [length]', 'length of video to convert in seconds or hh:mm:ss[.xxx] format [10]')
.parse(process.argv);

if (program.args.length < 2) {
program.help();
}

infile = program.args.shift();
outfile = program.args.shift();

options = {
width: program.width,
height: program.height,
delay: program.delay,
rate: program.rate,
start: program.start,
duration: program.duration
};

gify(infile, outfile, options, function(err) {
if (err) { throw err; }
console.log('Done.');
});
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gify",
"version": "0.1.0",
"repository": "visionmedia/gify",
"repository": "git://github.com/visionmedia/node-gify",
"description": "Convert videos to animated gifs",
"keywords": [
"gif",
Expand All @@ -13,14 +13,19 @@
"shell-escape": "0.0.0",
"debug": "*",
"uid2": "0.0.3",
"mkdirp": "~0.3.5"
"mkdirp": "~0.3.5",
"commander": "~2.0.0"
},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"bin": {
"gify": "./bin/gify"
},
"files": [
"index.js"
"index.js",
"bin/"
],
"license": "MIT"
}

0 comments on commit 81bd962

Please sign in to comment.