diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-02-03 07:02:32 +0800 |
---|---|---|
committer | Kevin Serrano <kevgagser@gmail.com> | 2017-02-03 07:02:32 +0800 |
commit | afb60b9061109d06fa678c730a3b0716d5718777 (patch) | |
tree | 66a8d43cbf8a7853b60089d70622c6e07175db9a /notices/notice-delete.js | |
parent | 3afa3592feef33070a997e53cf3a8b358c5ff703 (diff) | |
download | tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.gz tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.bz2 tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.lz tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.xz tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.tar.zst tangerine-wallet-browser-afb60b9061109d06fa678c730a3b0716d5718777.zip |
modification of notices.
Diffstat (limited to 'notices/notice-delete.js')
-rw-r--r-- | notices/notice-delete.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/notices/notice-delete.js b/notices/notice-delete.js new file mode 100644 index 000000000..652f96159 --- /dev/null +++ b/notices/notice-delete.js @@ -0,0 +1,27 @@ +var fs = require('fs') +var path = require('path') +var prompt = require('prompt') +var open = require('open') +var extend = require('extend') +var notices = require('./notices.json') + + +console.log('List of Notices') +console.log(`ID \t DATE \t\t\t TITLE`) +notices.forEach((notice) => { + console.log(`${(' ' + notice.id).slice(-2)} \t ${notice.date} \t ${notice.title}`) +}) +prompt.get(['id'], (error, res) => { +prompt.start() + if (error) { + console.log("Exiting...") + process.exit() + } + var index = notices.findIndex((notice) => { return notice.id == res.id}) + if (index === -1) { + console.log('Notice not found. Exiting...') + } + notices.splice(index, 1) + fs.unlink(`notices/archive/notice_${res.id}.md`) + fs.writeFile(`notices/notices.json`, JSON.stringify(notices)) +}) |