diff --git a/embed/cli/root/description.tmpl~ b/embed/cli/root/description.tmpl~ new file mode 100644 index 0000000..b61614c --- /dev/null +++ b/embed/cli/root/description.tmpl~ @@ -0,0 +1,62 @@ +{{define "description"}} +# Probo + +`probo` is a quiz management and administration system designed for +command line and text interface enthusiasts. `probo` aims to highlight +themes such as privacy, interoperability, accessibility, +decentralization, and quick usage speed. + +`probo` organizes information in plain text files and folders so that +data can be easily revised through version control systems. Quizzes +can be written in Markdown format, filters use the `jq` language, exam +sessions, participants, and their quiz answers are JSON files. + +`probo` contains a built-in web server that allows quizzes to be +administered to participants and their answers received. + +`probo` is a self-contained application that can be distributed through +a simple executable containing all necessary assets for its operation. + +# Quickstart + +1. Initialize the working directory + +``` +probo init +``` + +2. Create our first quiz. + +``` +probo create quiz > data/quizzes/quiz_1.md +``` + +3. Create two participants. + +``` +probo create participant > data/participants/john.json +probo create participant > data/participants/mary.json +``` + +4. Filter participants and quizzes (in this case, all participants and +all quizzes present in the store will be selected) and create an exam +session. + +``` +probo filter participant -f '.' | probo filter quizzes -f '.' | probo create session --name="My First Session" > data/sessions/my_session.json +``` + +5. Run the web server to allow participants to respond. + +``` +probo serve +``` + +6. Share the *qrcode* generated from the previous step with the participants and wait for them to finish responding. + +7. Explore the results. + +``` +probo filter responses -f '.' | probo rank +``` +{{end}} \ No newline at end of file diff --git a/embed/embed.go~ b/embed/embed.go~ new file mode 100644 index 0000000..e512117 --- /dev/null +++ b/embed/embed.go~ @@ -0,0 +1,61 @@ +package embed + +import ( + "embed" + "io" + "io/fs" + "os" + "path/filepath" +) + +var ( + //go:embed templates/* + Templates embed.FS + Assets embed.FS + //go:embed data/* + Data embed.FS +) + +func CopyToWorkingDirectory(data embed.FS) error { + currentDir, err := os.Getwd() + if err != nil { + return err + } + + if err := fs.WalkDir(data, ".", func(path string, info fs.DirEntry, err error) error { + if err != nil { + return err + } + + fullPath := path + + if info.IsDir() { + dirPath := filepath.Join(currentDir, path) + if err := os.MkdirAll(dirPath, 0755); err != nil { + return err + } + } else { + srcFile, err := data.Open(fullPath) + if err != nil { + return err + } + + dstFile, err := os.Create(filepath.Join(currentDir, path)) + if err != nil { + return err + } + defer dstFile.Close() + + _, err = io.Copy(dstFile, srcFile) + if err != nil { + return err + } + } + + return nil + }); err != nil { + return err + } + + return nil +}