Skip to content

Commit

Permalink
Update docs, less verbose debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
mklabs committed Apr 26, 2016
1 parent 5dfc6f0 commit 927e08c
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -15,4 +15,4 @@ after_success:
- npm run semantic-release
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
- /^v\d+\.\d+\.\d+$/
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
The MIT License (MIT)
The MIT 2011-2016 License (MIT)

Copyright (c) Mickael Daniel

Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Expand Up @@ -23,7 +23,7 @@ if (opts.help) {
console.log(commands.help());
process.exit(0);
} else if (allowed.indexOf(cmd) !== -1) {
debug('Run command %s with options', cmd, opts);
// debug('Run command %s with options', cmd, opts);
commands[cmd](opts);
} else {
console.log(commands.help());
Expand Down
6 changes: 0 additions & 6 deletions lib/complete.js
Expand Up @@ -45,13 +45,11 @@ class Complete extends EventEmitter {
// });
constructor(options) {
super();
debug('Init complete');
this.options = options || this.defaults;
this.options.name = this.options.name || this.resolve('name');
}

start() {
debug('Listen for completion');
this.handle();
}

Expand Down Expand Up @@ -93,7 +91,6 @@ class Complete extends EventEmitter {
}

completePackage(env) {
debug('Lookup tabtab configuration in package.json');
var config = this.resolve('tabtab');
if (!config) return;

Expand Down Expand Up @@ -127,7 +124,6 @@ class Complete extends EventEmitter {
recv(err, completions, env) {
env = env || this.env;

debug('> Completions:', completions);
if (err) return this.emit('error', err);
completions = Array.isArray(completions) ? completions : [completions];

Expand Down Expand Up @@ -232,8 +228,6 @@ class Complete extends EventEmitter {
//
// Returns the script content with placeholders replaced
script(name, completer, shell) {
debug('Script %s name with %s completer', name, completer);
debug('Shell', shell);
return read(join(__dirname, `../scripts/${shell || 'completion'}.sh`), 'utf8')
.replace(/\{pkgname\}/g, name)
.replace(/{completer}/g, completer);
Expand Down
8 changes: 2 additions & 6 deletions lib/installer.js
Expand Up @@ -48,7 +48,6 @@ export default class Installer {
var destination = data.destination;
debug('Installing completion script to %s directory', destination);

debug('Script', this.options.name, this.options.completer, this.options);
var script = this.complete.script(this.options.name, this.options.completer || this.options.name, this.template);

if (destination === 'stdout') return process.stdout.write('\n\n' + script + '\n');
Expand All @@ -64,13 +63,12 @@ export default class Installer {
}

createStream(destination, r, errback) {
debug('Check %s destination', destination);
// debug('Check %s destination', destination);
var flags = 'a';
fs.stat(destination, (err, stat) => {
if (err && err.code === 'ENOENT') flags = 'w';
else if (err) return errback(err);

debug('Create output stream on', destination, flags);
mkdirp(path.dirname(destination), (err) => {
if (err) return errback(err);

Expand All @@ -93,7 +91,6 @@ export default class Installer {

installCompletion(destination, out) {
var name = this.options.name;
debug('Shell template:', this.template);
var script = this.complete.script(name, this.options.completer || name, this.template);
var filename = path.join(__dirname, '../.completions', name + '.' + this.template);
debug('Writing actual completion script to %s', filename);
Expand All @@ -112,7 +109,7 @@ export default class Installer {
return debug('Already installed %s in %s', name, destination);
}

console.error('\n[tabtab] Adding source line to load $TABTAB_DIR/.completions/%s\nin %s\n', filename, destination);
console.error('\n[tabtab] Adding source line to load %s\nin %s\n', filename, destination);

out.write('\n');
debug('. %s > %s', filename, destination);
Expand Down Expand Up @@ -165,7 +162,6 @@ export default class Installer {
return new Promise((r, errback) => {
var shell = process.env.SHELL;
if (shell) shell = shell.split('/').slice(-1)[0];
debug('User shell:', shell);
if (!this[shell]) {
debug('User shell %s not supported', shell);
return errback(new Error('Shell not supported: ' + shell));
Expand Down

0 comments on commit 927e08c

Please sign in to comment.