Skip to content

Instantly share code, notes, and snippets.

@hugolpz
Last active June 14, 2019 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugolpz/c25a9d513e2111f13f1e6015754fb919 to your computer and use it in GitHub Desktop.
Save hugolpz/c25a9d513e2111f13f1e6015754fb919 to your computer and use it in GitHub Desktop.
Create groups structure.
## Description
Create cri groups structure from markdown textfile.
## Install
1. Copy files
2. Edit input.txt
3. Terminal > `npm install` (assumes you have nodejs and npm on your computer)
4. Terminal > `node index.js`
#! /usr/bin/env node
// TRY ME : https://npm.runkit.com/ascii-tree
//var fs = require('fs');
var asciitree = require('ascii-tree');
//var str = fs.readFileSync('input.txt', 'utf8');
var str = `#CRI
##cri.pro@cri-paris.org
###cri.staff@cri-paris.org
###cri.research@cri-paris.org
###cri.labs@cri-paris.org
##cri.students@cri-paris.org`;
var tree = asciitree.generate(str);
//fs.writeFile('./output.txt', tree, 'utf8', function(){ console.log(tree)} );
##cri.pro@cri-paris.org
###cri.staff@cri-paris.org
###cri.research@cri-paris.org
###cri.labs@cri-paris.org
##cri.students@cri-paris.org
{
"name": "cri-groups-tree",
"version": "1.0.0",
"description": "use markdown file to create tree structure of cri groups ",
"main": "index.js",
"bin": {
"cri-groups-tree": "index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"criparis",
"ascii-tree"
],
"author": "hugolpz",
"license": "ISC",
"dependencies": {
"ascii-tree": "^0.3.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment