People know that wiki is necessary documentation agent, but there are obstacles like...
1) You cannot customize wiki as you prefer for it affects whole team or entire company. (so veto to deployment of plugins occurs often).
2) There sometimes appears necessity to handle trivial document data,
locally.
3) Your local documents piled/messed up as time passes and you no longer be able to manage almost all of these documents any longer. It is pretty hard to refer to something embedded in the document saved two years ago on your hard drive, which you ain't remember any more.
The
liki emerged for these reasons. We need to create, relate(this part not implemented yet), update, grep, find documents efficiently, locally, as wiki. Keyword-based search easily let user find what they want to look for. This script had to be used solely via terminal because terminal/editor oriented developer always suffered for GUI-based development or third party tool which had disgusted them for a long time.
TODO// See also or tagged-link function. (we need to establish dsl here)
Here is the repository:
https://github.com/keitaroemotion/liki/blob/master/liki
Here is the code (in progress)
indentation is dead here so you need to look out github
wiki_dir = "/usr/local/etc/liki/pages" |
if(not os.path.exists(directory)): |
def addChild(node, term): |
return (node + "/{0}").format(term) |
def getDirectory(rootdir, folder): |
return makeDirs(addChild(rootdir, folder)) |
return addChild(getDirectory(wiki_dir, term[0]), term) |
def writeToFile(page, text, mode="a"): |
def makeText(text, addition, message=""): |
sys.stdout.write(message) |
return text if (addition == "fin") else makeText(text + addition + "\n", raw_input()) |
def findPage(keyword=""): |
sys.stdout.write("[find] word: ") |
result_list = [f for f in listdir(getDirectory(wiki_dir, keyword[0])) if f.startswith(keyword)] |
True : (lambda x : showPage(x[0])), |
False : (lambda x : findPage()) |
}[len(result_list) == 1](result_list) |
f = open(getPage(page), "r") |
sys.stdout.write("[create] word: ") |
page = getPage(raw_input()) |
writeToFile(page, makeText("", "", "text[type fin at EOF]: \n")) |
# here is the main execution part. |
# if argument does not exist, show help message |
print("you need argument") |
print("[find] : find page") |
print("[create] : create page\n") |
# dispatch execution function |
}[sys.argv[1]]()
No comments:
Post a Comment