Skip to content

Commit

Permalink
Updated to new komi
Browse files Browse the repository at this point in the history
Signed-off-by: Sandy <sandy@sandyuraz.com>
  • Loading branch information
thecsw committed Mar 20, 2023
1 parent d59b10f commit 5941731
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion emilia/explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func FindFilesByExt(pool komi.PoolConnector[yunyun.FullPathFile], ext string) <-
func FindFilesByExtSimple(ext string) []yunyun.FullPathFile {
toReturn := make([]yunyun.FullPathFile, 0, 64)
addFile := func(v yunyun.FullPathFile) { toReturn = append(toReturn, v) }
filesPool := komi.NewPool(komi.WorkSimple(addFile))
filesPool := komi.New(komi.WorkSimple(addFile))
<-FindFilesByExt(filesPool, ext)
filesPool.Close()
return toReturn
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require github.com/BurntSushi/toml v1.2.1

require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/charmbracelet/log v0.1.2 // indirect
github.com/charmbracelet/log v0.2.0 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
Expand All @@ -17,10 +17,10 @@ require (
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6 // indirect
golang.org/x/image v0.5.0 // indirect
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
golang.org/x/image v0.6.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/term v0.6.0 // indirect
)

require (
Expand All @@ -31,8 +31,8 @@ require (
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213
github.com/karrick/godirwalk v1.17.0
github.com/pkg/errors v0.9.1
github.com/schollz/progressbar/v3 v3.13.0
github.com/thecsw/gana v0.0.0-20221119221619-ec55f13e6a5d
github.com/thecsw/haruhi v0.0.0-20230212193023-1d4512254cfd
github.com/thecsw/komi v0.0.0-20230320055516-6bc29b90dc5f
github.com/schollz/progressbar/v3 v3.13.1
github.com/thecsw/gana v0.0.0-20230302033602-789da1301422
github.com/thecsw/haruhi v0.0.0-20230320043919-14785d9364c1
github.com/thecsw/komi v0.0.0-20230320184139-c735b3f3f5c3
)
57 changes: 22 additions & 35 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk=
github.com/charmbracelet/lipgloss v0.7.1 h1:17WMwi7N1b1rVWOjMT+rCh7sQkvDU75B2hbZpc5Kc1E=
github.com/charmbracelet/lipgloss v0.7.1/go.mod h1:yG0k3giv8Qj8edTCbbg6AlQ5e8KNWpFujkNawKNhE2c=
github.com/charmbracelet/log v0.1.2 h1:xmKMxo0T/lcftgggQOhUkS32exku2/ID55FGYbr4nKQ=
github.com/charmbracelet/log v0.1.2/go.mod h1:86XdIdmrubqtL/6u0z+jGFol1bQejBGG/qPSTwGZuQQ=
github.com/charmbracelet/log v0.2.0 h1:xx1ssrisRsAwVKyj7A7H3kIFdiuFWR9p2hse7B08jxY=
github.com/charmbracelet/log v0.2.0/go.mod h1:3/Kcg0B7Y6ou8JFPy6gIAl1YuV0QmRfmeVxmiDt3eas=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -24,20 +23,15 @@ github.com/karrick/godirwalk v1.17.0 h1:b4kY7nqDdioR/6qnbHQyDvmA17u5G1cZ6J+CZXwS
github.com/karrick/godirwalk v1.17.0/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68/go.mod h1:Xk+z4oIWdQqJzsxyjgl3P22oYZnHdZ8FFTHAQQt5BMQ=
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs=
github.com/muesli/termenv v0.15.1 h1:UzuTb/+hhlBugQz28rpzey4ZuKcZ03MeKsoG7IJZIxs=
github.com/muesli/termenv v0.15.1/go.mod h1:HeAQPTzpfs016yGtA4g00CsdYnVLJvxsS4ANqrZs2sQ=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand All @@ -46,66 +40,59 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/schollz/progressbar/v3 v3.13.0 h1:9TeeWRcjW2qd05I8Kf9knPkW4vLM/hYoa6z9ABvxje8=
github.com/schollz/progressbar/v3 v3.13.0/go.mod h1:ZBYnSuLAX2LU8P8UiKN/KgF2DY58AJC8yfVYLPC8Ly4=
github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE=
github.com/schollz/progressbar/v3 v3.13.1/go.mod h1:xvrbki8kfT1fzWzBT/UZd9L6GA+jdL7HAgq2RFnO6fQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/thecsw/gana v0.0.0-20221119221619-ec55f13e6a5d h1:EwCOe/dtLb8LhlSm1y0B2PKgDrCX2T6Mg8t9PhiGCLM=
github.com/thecsw/gana v0.0.0-20221119221619-ec55f13e6a5d/go.mod h1:peUsRpO0qD0S5GdV+95GLWBNOUq59MuA1l1HRfL65aw=
github.com/thecsw/haruhi v0.0.0-20230212193023-1d4512254cfd h1:lJM29JOH/IkuwIceRIx1GmTcUU0wDEJnN+AfU/U/tRk=
github.com/thecsw/haruhi v0.0.0-20230212193023-1d4512254cfd/go.mod h1:LqtWkO3R58Osjp+YUSljW2JftpM2P2OmOWh4SWR2fSc=
github.com/thecsw/komi v0.0.0-20230320045556-d944184c07eb h1:xpK9kCsDCYejc/+DFlRWeenEjL6G3ILj2lI/xuaIxUQ=
github.com/thecsw/komi v0.0.0-20230320045556-d944184c07eb/go.mod h1:II/vWfZd0BfrJrPN6M8lapWc9plFVg1cBJ8LiR0bsck=
github.com/thecsw/komi v0.0.0-20230320055516-6bc29b90dc5f h1:NdiHZDOB2UtEBLt7cPlHe+7RpVsbQx3r6/2CC6j9TYE=
github.com/thecsw/komi v0.0.0-20230320055516-6bc29b90dc5f/go.mod h1:II/vWfZd0BfrJrPN6M8lapWc9plFVg1cBJ8LiR0bsck=
github.com/thecsw/gana v0.0.0-20230302033602-789da1301422 h1:aB9iKJRev+s8tezrqXy1XjwclU3HKAAUxSYz0ZJlXQ8=
github.com/thecsw/gana v0.0.0-20230302033602-789da1301422/go.mod h1:peUsRpO0qD0S5GdV+95GLWBNOUq59MuA1l1HRfL65aw=
github.com/thecsw/haruhi v0.0.0-20230320043919-14785d9364c1 h1:ia5BsYxROECDZnMWMx7aw+iw9TfS7DM9ILEJ/XFUryY=
github.com/thecsw/haruhi v0.0.0-20230320043919-14785d9364c1/go.mod h1:ZCskUH8LmpStDG9+AZzaQ4pSAC9EP2CUfDwiRNyndHw=
github.com/thecsw/komi v0.0.0-20230320184139-c735b3f3f5c3 h1:dVY2ndF3FjDq44F8n4UlPe2KUfLUTlYPv32BjJ6gcoU=
github.com/thecsw/komi v0.0.0-20230320184139-c735b3f3f5c3/go.mod h1:wGGWD6Ck+Fup6i+bNaHH/BH+wad838rcCu8VnQsl67c=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6 h1:Ic9KukPQ7PegFzHckNiMTQXGgEszA7mY2Fn4ZMtnMbw=
golang.org/x/exp v0.0.0-20230212135524-a684f29349b6/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 h1:pVgRXcIictcr+lBQIFeiwuwtDIs4eL21OuM9nyAADmo=
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.5.0 h1:5JMiNunQeQw++mMOz48/ISeNu3Iweh/JaZU8ZLqHRrI=
golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4=
golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4=
golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
48 changes: 28 additions & 20 deletions ichika/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,34 @@ func BuildCommandFunc() {

// build uses set flags and emilia data to build the local directory.
func build() {
// Create all the pools
filesPool := komi.NewPool(komi.Work(openPage), poolSettings("Reading 📚 ")...)
parserPool := komi.NewPool(komi.Work(parsePage), poolSettings("Parsing 🧹")...)
exporterPool := komi.NewPool(komi.Work(exportPage), poolSettings("Exporting 🥂")...)
writerPool := komi.NewPool(komi.WorkSimpleWithErrors(writePage), poolSettings("Writing 🎸", 1)...)

// Create the pool that reads files and returns their handles.
filesPool := komi.NewWithSettings(komi.Work(openPage), &komi.Settings{
Name: "Reading 📚 ",
Laborers: customNumWorkers,
Debug: debugEnabled,
})

// Create a pool that take a files handle and parses it out into yunyun pages.
parserPool := komi.NewWithSettings(komi.Work(parsePage), &komi.Settings{
Name: "Parsing 🧹 ",
Laborers: customNumWorkers,
Debug: debugEnabled,
})

// Create a pool that that takes yunyun pages and exports them into request format.
exporterPool := komi.NewWithSettings(komi.Work(exportPage), &komi.Settings{
Name: "Exporting 🥂 ",
Laborers: customNumWorkers,
Debug: debugEnabled,
})

// Create a pool that reads the exported data and writes them to target files.
writerPool := komi.NewWithSettings(komi.WorkSimpleWithErrors(writePage), &komi.Settings{
Name: "Writing 🎸",
Laborers: 1,
Debug: debugEnabled,
})

// Handle any errors from the writing.
go func() {
Expand Down Expand Up @@ -88,9 +111,6 @@ func build() {

<-emilia.FindFilesByExt(filesPool, emilia.Config.Project.Input)

// filesPool.Wait()
// parserPool.Wait()
// exporterPool.Wait()
writerPool.Close()

finish := time.Now()
Expand All @@ -101,18 +121,6 @@ func build() {
fmt.Printf("Processed %d files in %d ms\n", exporterPool.JobsCompleted(), finish.Sub(start).Milliseconds())
}

func poolSettings(name string, oneLaborer ...int) []komi.PoolSettingsFunc {
numLaborers := customNumWorkers
if len(oneLaborer) > 0 {
numLaborers = 1
}
return []komi.PoolSettingsFunc{
komi.WithName(name),
komi.WithLaborers(numLaborers),
komi.WithDebug(),
}
}

//go:inline
func openPage(v yunyun.FullPathFile) gana.Tuple[yunyun.FullPathFile, *os.File] {
return openFile(v)
Expand Down
15 changes: 10 additions & 5 deletions ichika/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,26 @@ import (
var (
// workDir is the directory to look for files.
workDir = "."

// darknessToml is the location of `darkness.toml`.
darknessToml = "darkness.toml"

// filename is the file to build.
filename = "index.org"

// defaultNumOfWorkers gives us the number of workers to
// spin up in each stage: parsing and processing.
defaultNumOfWorkers = 14

// disableParallel sets the number of workers to 1.
disableParallel bool

// customNumWorkers sets the custom number of workers.
customNumWorkers int
// customChannelCapacity low-level sets the capacity of
// workers' input/output capacity, defaults to the default
// number of workers.
customChannelCapacity int

// debugEnabled tells us whether to show debug logs.
debugEnabled bool

// useCurrentDirectory is used for development and local
// serving, such that you can browse the url files locally.
useCurrentDirectory bool
Expand All @@ -39,7 +44,7 @@ func getEmiliaOptions(cmd *flag.FlagSet) *emilia.EmiliaOptions {
cmd.StringVar(&darknessToml, "conf", "darkness.toml", "location of darkness.toml")
cmd.BoolVar(&disableParallel, "disable-parallel", false, "disable parallel build (only use one worker)")
cmd.IntVar(&customNumWorkers, "workers", defaultNumOfWorkers, "number of workers to spin up")
cmd.IntVar(&customChannelCapacity, "capacity", defaultNumOfWorkers, "worker channels' capacity")
cmd.BoolVar(&debugEnabled, "debug", false, "enable debug logs")
cmd.BoolVar(&useCurrentDirectory, "dev", false, "use local path for urls (development)")
cmd.BoolVar(&vendorGalleryImages, "vendor-galleries", false, "stub in local copies of gallery links (SLOW)")
if err := cmd.Parse(os.Args[2:]); err != nil {
Expand Down

0 comments on commit 5941731

Please sign in to comment.