diff options
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Dockerfile | 24 | ||||
-rw-r--r-- | README | 15 | ||||
-rw-r--r-- | bin/main.ml | 36 |
4 files changed, 63 insertions, 13 deletions
@@ -1,3 +1,4 @@ _build/* .direnv result +release diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..937fbcf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM alpine:edge AS builder + +# Install the build dependencies +RUN apk add --no-cache make m4 which patch sudo wget git pkgconfig \ + gcc g++ musl-dev linux-headers libffi libffi-dev pcre perl python3 \ + gmp-dev pcre-dev xz-dev gmp xz coreutils \ + ocaml ocaml-compiler-libs ocaml-ocamldoc opam ocaml-findlib openssh +RUN chmod +s `which bwrap` + +RUN addgroup -g 1000 -S ocaml && adduser -u 1000 -D -S ocaml -G ocaml +USER ocaml +WORKDIR /home/ocaml + +RUN opam init --auto-setup --disable-sandboxing --yes -c 4.14.2 --keep-build-dir +RUN eval `opam env --switch=4.14.2` + +RUN opam install --yes dune && eval `opam env --switch=4.14.2` + +COPY --chown=ocaml:ocaml . /tmp/build +WORKDIR /tmp/build +RUN git config --global --add safe.directory /tmp/build + +RUN opam install . --update-invariant --yes +CMD eval `opam env` && dune build --profile release @@ -82,8 +82,8 @@ _________________ 1.5 DEVELOPMENT ~~~~~~~~~~~~~~~ - To set up the project, easiest way is to just install Nix, direnv and - enable nix flakes. Then to compile: + To set up the project for local development, easiest way is to just install Nix, direnv + and enable nix flakes. Then to compile: dune build @@ -95,9 +95,15 @@ _________________ dune exec -- stitch --help=groff - To prepare for release, run + To prepare for release, we need to statically link the binary, which unless you use a + musl based distro it will not do out of the box. - dune build --profile release + There is a Dockerfile included that prepares the release, use it with podman: + + podman pull docker.io/alpine:edge + podman build . -t stitch:latest + mkdir release + podman run -v ./release:/tmp/build/_build:U stitch:latest Binary will be found in ./_build/default/bin/stitch @@ -110,6 +116,7 @@ _________________ - Support command pipign and hotkeys - Line wrapping - Support URL shortening. + - Better result narrowing 2 KNOWN ISSUES diff --git a/bin/main.ml b/bin/main.ml index 79addc1..385f273 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -86,13 +86,23 @@ let headlines_cmd = ; `Pre "export STITCH_DIRECTORY=/home/bob/notes" ; `P "Stitch does not specify anything on how to capture your notes, but you can add \ - the following in your profile to have a basic note capture command" + the following in your profile to have a basic note capturing system." ; `Pre "function capture {\n\ - \ NEW_NOTE=\"\\$STITCH_DIRECTORY/\\$(date +'%y-%m-%d.%H:%M.%S').org\"\n\ - \ echo '* ' >> \\$NEW_NOTE \n\ - \ \\$EDITOR \"\\$NEW_NOTE\" +1:3 \"\n\ - }\n" + \ JRNL=\"\\$STITCH_DIRECTORY/\\$(date +'%y-%m-%d.%H:%M.%S').org\"\n\ + \ echo '* ' > /tmp/capture \n\ + \ $EDITOR /tmp/capture +1\n\ + \ if grep -q '^\\*\\s*\\$' /tmp/capture \n\ + \ then \n\ + \ echo \"Empty capture; ignoring\"\n\ + \ else \n\ + \ echo \"Storing capture in \\$JRNL\"\n\ + \ cat /tmp/capture > \\$JRNL\n\ + \ fi\n\ + }" + ; `P + "Now you can run capture in your terminal and it will prompt you to write your \ + note and store it in your notes with a timestamp." ; `P "With that, you can begin to capture your notes and they will be displayed in \ reverse chronological order in stitch. You can add tags, for example :journal: \ @@ -110,9 +120,17 @@ let headlines_cmd = capture TODO items" ; `Pre "function todo {\n\ - \ NEW_NOTE=\"\\$STITCH_DIRECTORY/\\$(date +'%y-%m-%d.%H:%M.%S').org\"\n\ - \ echo '* TODO ' >> \\$NEW_NOTE \n\ - \ \\$EDITOR \"\\$NEW_NOTE\" +1 \n\ + \ TODO_BASE='* TODO '\n\ + \ JRNL=\"\\$STITCH_DIRECTORY/\\$(date +'%y-%m-%d.%H:%M.%S').org\"\n\ + \ echo '* TODO ' > /tmp/capture\n\ + \ \\$EDITOR /tmp/capture +1\"\n\ + \ if grep -q '^\\* TODO\\s*\\$' /tmp/capture \n\ + \ then \n\ + \ echo \"Empty capture\"\n\ + \ else \n\ + \ echo \"Storing capture in \\$JRNL\"\n\ + \ cat /tmp/capture > \\$JRNL\n\ + \ fi\n\ }" ; `P "After that, you can capture a few TODO items, and you will be able to view them \ @@ -129,7 +147,7 @@ let headlines_cmd = Cmd.info ~envs "stitch" - ~version:"0.1 ALPHA" + ~version:"0.0.1 ALPHA" ~doc ~man:(List.concat [ bugs; author; description; example_set_up_basic; credit ]) in |