2016-02-13 97 views
0

我有興趣創建一個可以從命令行運行的工具(pref.linux),它將掃描選定的一組文件(想想反向的.gitignore),解析這些文件文件,並創建一個像這樣的圖像Conceptboard。它不需要看起來像這樣,但我應該能夠控制圖形效果和盒裝元素的佈局。每個盒裝元素應該只是將文件名稱放在最上面,並將文件的內容放在下面。可視化目錄的文件結構和文件內容

我的問題是:

  • 什麼工具可以爲這種類型的項目?
  • 我從哪裏開始邏輯開始?
  • 我應該等待多久才能接受我?

編輯:graphviz肯定可以工作,但是它能顯示文件內容嗎?

回答

0

Graphviz無法直接顯示文件內容,但我經常將它與java或python中的代碼結合起來構建適當的.dot文件,然後在該.dot文件上運行graphviz以生成最終圖形,類似於這個僞代碼:

open .dot text file and add graphviz header information 
for each file in directory: 
    save filename for future reference 
    read and save file contents 

    create node in .dot file formatted with filename at top and contents below 

for each file in directory: 
    parse file to locate links to other files 
    if filename has been processed above, add a link line to .dot output file 
add graphviz footer to .dot file 
run DOT on .dot file 

最終.DOT文件將是這個樣子,只是長得多:

digraph fileStructure { 
    node [shape=box, color=black, fontsize=14, fillcolor=white, style=filled] 
    1 [label="filename\nfile contents"] 
    2 [label="filename\nfile contents"] 
    3 [label="filename\nfile contents"] 

    1 -> 2 
    1 -> 3 
} 

有庫最重要的編程語言簡化創建.dot文件的過程中,運行graphviz,但這並不難直接做。

需要多長時間取決於您的技能水平,但我不認爲這需要超過幾個小時才能完成。