Skip to content

Commit

Permalink
style: Added comments for showInfo function
Browse files Browse the repository at this point in the history
  • Loading branch information
salsan committed Jul 21, 2021
1 parent d593882 commit 8d04b6b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions otu.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ yargs(hideBin(process.argv))
}
})
.command('show [input] [Options]', 'show info about theme', {
scene: {
scenes: {
description: 'show list of scene present',
type: 'boolean',
default: false
Expand All @@ -151,12 +151,17 @@ yargs(hideBin(process.argv))
.alias('version', 'v')
.argv;

/**
* @description Show info about theme scene
* @param {string} fsource - source file
* @param {Object} options - Options
*/

function showInfo(fsource, options) {
fs.readFile(fsource, 'utf8', (err, data) => {
const theme = JSON.parse(data);

if (options.scene) {
if (options.scenes) {
theme.scene_order.forEach((scene, index) => {
console.log(index + '\t- "' + scene.name + '"');
const itemsRequired = theme['sources'].filter(item => item.name === scene.name);
Expand Down Expand Up @@ -261,8 +266,8 @@ function addScene(fsource, fdest, sceneArchive, options) {
});

});

}

/**
* @description checkItemsRequired check all items required from scene
* @param {Object} theme - full source of original theme
Expand Down Expand Up @@ -360,7 +365,7 @@ function extractScene(fsource, fdest, sceneName, options) {
console.log('Completed!!! ' + fdest + '.otu');


} else console.log('"'+sceneName + '" is not present, please use showInfo command for see list of scene available, more info --help');
} else console.log('"' + sceneName + '" is not present, please use showInfo command for see list of scene available, more info --help');
});

}
Expand Down

0 comments on commit 8d04b6b

Please sign in to comment.