소스 검색

add scripts and stuff necessary to automatically generate the diagram using graph-easy...

required writting a simple awk script to add the necessary border for MarkDeep..
haven't integrated the diagram generation into the file yet..
main
John-Mark Gurney 4 년 전
부모
커밋
cb870fadaa
4개의 변경된 파일72개의 추가작업 그리고 0개의 파일을 삭제
  1. +6
    -0
      Makefile
  2. +32
    -0
      box.sh
  3. +25
    -0
      diag.txt
  4. +9
    -0
      diag_inp.txt

+ 6
- 0
Makefile 파일 보기

@@ -0,0 +1,6 @@
# https://github.com/ironcamel/Graph-Easy
diag.txt: diag_inp.txt box.sh
graph-easy < $< | sh box.sh > $@

diagtest:
ls box.sh diag_inp.txt Makefile | entr sh -c 'make diag.txt && cat diag.txt'

+ 32
- 0
box.sh 파일 보기

@@ -0,0 +1,32 @@
#!/bin/sh
fname=$(mktemp foobar.XXXXX)
cat > "$fname"
awk '
maxline == 1 {
if (maxlength < length)
maxlength = length
}

function printtop () {
blank = ""
for (i = 0; i < maxlength + 4; i++)
blank = blank "*"
printf("%s\n", blank)
}

output == 1 && FNR == 1 {
printtop()
printf("* %*s *\n", maxlength, "")
}

output == 1 {
printf("* %s%*s *\n", $0, maxlength - length, "")
}

END {
printf("* %*s *\n", maxlength, "")
printtop()
}
' maxline=1 "$fname" maxline=0 output=1 "$fname"

rm "$fname"

+ 25
- 0
diag.txt 파일 보기

@@ -0,0 +1,25 @@
*********************************************************************************
* *
* +-------------+ *
* | Internet | *
* +-------------+ *
* | *
* | *
* | *
* +----------------+ +-------------+ *
* | Host machine |-----------------------------| VLAN Switch | *
* +----------------+ +-------------+ *
* | | *
* | | *
* | | *
* +----------------+ +-----------------+ +-------------+ +--------+ *
* | USB Hub | --- | Power Controler | --- | RockPro64 | | 12V PS | *
* +----------------+ +-----------------+ +-------------+ +--------+ *
* | | | | *
* | +-----------------------+-------------------+ *
* | | *
* +----------------+ | *
* | Serial adapter |-------------------------------+ *
* +----------------+ *
* *
*********************************************************************************

+ 9
- 0
diag_inp.txt 파일 보기

@@ -0,0 +1,9 @@
[ Internet ] { flow: north } -- [ VLAN Switch ]
[ Host machine ] -- [ VLAN Switch ]
[ Host machine ] { flow: south } -- [ USB Hub ]
[ RockPro64 ] { flow: north } -- [ VLAN Switch ]
[ USB Hub ] -- [ Power Controler ]
[ USB Hub ] -- [ Serial adapter ]
[ Serial adapter ] -- [ RockPro64 ]
[ Power Controler ] -- [ 12V PS ]
[ Power Controler ] { flow: east } -- [ RockPro64 ]

불러오는 중...
취소
저장