vhs icon indicating copy to clipboard operation
vhs copied to clipboard

Code organization

Open rm-dr opened this issue 2 years ago • 5 comments

Right now, all the sources of vhs are piled into the root of this repository. We'll need to clean that up sooner or later, into at least one src/ subdir.

I presume that it would be best do do this when there aren't many features in progress, so that merging into moved files is less of a headache.

rm-dr avatar Nov 24 '22 06:11 rm-dr

Hey! I agree, keeping everything in the root is getting a bit too much. Moving into package is probably a better option.

maaslalani avatar Nov 25 '22 16:11 maaslalani

Hey!

I agree with you guys. I believe it would be more easy to work just adding a few packages. However rearrange the structure depends on personal tastes.

@maaslalani @rm-dr how would you structure it?

elmarsan avatar May 14 '23 10:05 elmarsan

I would probably structure the code as a few separate packages.

  • lexer (token / keyword related code)
  • parser (language / command related code)
  • video (ffmpeg related code)
  • tty (ttyd / browser related code)

But, very open to suggestions if there are better ways to organize the code.

maaslalani avatar May 15 '23 03:05 maaslalani

I'm my mind I've got something like this:

  • pkg (vhs internals)
    • lexer
    • parser
    • command
      • command_x.go
      • command_x_test.go
      • command_y.go
      • command_y_test.go
  • cmd (Cobra commands)
    • root.go
    • record.go
    • serve.go

elmarsan avatar May 16 '23 21:05 elmarsan

Still not perfect organization but I did factor out the lexer and parser so that others can build on top of the language!

maaslalani avatar May 31 '24 03:05 maaslalani