mirror of https://github.com/gbmor/clinte
Compare commits
6 Commits
9d8bbab3ce
...
f682df279f
Author | SHA1 | Date |
---|---|---|
Benjamin Morrison | f682df279f | |
Benjamin Morrison | 4b30a05ba2 | |
Benjamin Morrison | 3eac3167ac | |
Benjamin Morrison | a69f61ca98 | |
Benjamin Morrison | e7544b9b1d | |
Benjamin Morrison | fe77fcfc55 |
|
@ -9,5 +9,5 @@ environment:
|
||||||
tasks:
|
tasks:
|
||||||
- build: |
|
- build: |
|
||||||
cd clinte
|
cd clinte
|
||||||
cargo test
|
cargo check
|
||||||
cargo build
|
cargo test
|
|
@ -15,6 +15,6 @@ before_script:
|
||||||
- bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh)
|
- bash <(curl https://raw.githubusercontent.com/xd009642/tarpaulin/master/travis-install.sh)
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cargo build --verbose
|
- cargo check
|
||||||
- cargo tarpaulin --out Xml
|
- cargo tarpaulin --out Xml
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
|
@ -103,7 +103,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clinte"
|
name = "clinte"
|
||||||
version = "2.1.3"
|
version = "2.1.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "clinte"
|
name = "clinte"
|
||||||
version = "2.1.3"
|
version = "2.1.4"
|
||||||
authors = ["Ben Morrison <ben@gbmor.dev>"]
|
authors = ["Ben Morrison <ben@gbmor.dev>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "CLI note posting system for shared UNIX boxes."
|
description = "CLI note posting system for shared UNIX boxes."
|
||||||
|
|
26
Makefile
26
Makefile
|
@ -14,32 +14,9 @@ clean:
|
||||||
cargo clean
|
cargo clean
|
||||||
@printf "\n%s\n" "...Done!"
|
@printf "\n%s\n" "...Done!"
|
||||||
|
|
||||||
.PHONY: update
|
|
||||||
update:
|
|
||||||
@printf "\n%s\n" "Making sure we're on master..."
|
|
||||||
git checkout master
|
|
||||||
|
|
||||||
@printf "\n%s\n" "Updating from upstream repository..."
|
|
||||||
git pull --rebase
|
|
||||||
|
|
||||||
@printf "\n%s\n" "Checking out latest tag..."
|
|
||||||
git checkout $(git describe --tags --abbrev=0)
|
|
||||||
|
|
||||||
@printf "\n%s\n" "...Done!"
|
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
@printf "\n%s\n" "Installing clinte..."
|
@sh install.sh $(PREFIX)
|
||||||
@printf "\n%s\n" "Creating directories..."
|
|
||||||
mkdir -p $(DBDIR)
|
|
||||||
|
|
||||||
@printf "\n%s\n" "Copying files..."
|
|
||||||
install -m755 target/release/clinte $(BINDIR)
|
|
||||||
|
|
||||||
@if [ -f "$(DBDIR)/clinte.json" ]; then printf "\n%s\n" "clinte.json exists. Skipping ..."; else install -m666 clinte.json "$(DBDIR)"; fi
|
|
||||||
@if [ -e /etc/profile.d ]; then printf "%s\n" "Installing check_new_clinte_posts.sh to /etc/profile.d" && install -m644 check_new_clinte_posts.sh /etc/profile.d/; fi
|
|
||||||
|
|
||||||
@printf "\n%s\n" "...Done!"
|
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
|
@ -51,6 +28,7 @@ test:
|
||||||
uninstall:
|
uninstall:
|
||||||
@printf "\n%s\n" "Uninstalling clinte..."
|
@printf "\n%s\n" "Uninstalling clinte..."
|
||||||
rm -f $(BINDIR)/clinte
|
rm -f $(BINDIR)/clinte
|
||||||
|
rm -f $(PREFIX)/share/man/man1/clinte.1
|
||||||
@if [ -e /etc/profile.d ]; then printf "%s\n" "rm -f /etc/profile.d/check_new_clinte_posts.sh" && rm -f /etc/profile.d/check_new_clinte_posts.sh; fi
|
@if [ -e /etc/profile.d ]; then printf "%s\n" "rm -f /etc/profile.d/check_new_clinte_posts.sh" && rm -f /etc/profile.d/check_new_clinte_posts.sh; fi
|
||||||
@printf "\n%s\n" "...Done!"
|
@printf "\n%s\n" "...Done!"
|
||||||
@printf "%s %s\n" "The posts are still intact in" $(DBDIR)
|
@printf "%s %s\n" "The posts are still intact in" $(DBDIR)
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
.Dd July 3, 2020
|
||||||
|
.Dt CLINTE 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm clinte
|
||||||
|
.Nd Command-line community notes board - CLI NoTEs
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Op Fl v
|
||||||
|
.Op Fl l Ar length
|
||||||
|
.Op post
|
||||||
|
.Op update Ar id
|
||||||
|
.Op delete Ar id
|
||||||
|
.
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
is a command-line community notes board, aimed at public-access UNIX systems.
|
||||||
|
Users may append a note, which is automatically tagged with their username.
|
||||||
|
Other users may view all notes, but users may only edit or delete their own.
|
||||||
|
Upon login, users are notified of unseen notes.
|
||||||
|
.Pp
|
||||||
|
All flags and commands are optional.
|
||||||
|
The default behavior is to display the 15 most recent posts.
|
||||||
|
.Pp
|
||||||
|
Subject lines are truncated to 30 characters.
|
||||||
|
Post bodies are truncated to 500 characters.
|
||||||
|
.Pp
|
||||||
|
When creating a new post or editing a previous post,
|
||||||
|
.Ev $EDITOR
|
||||||
|
is called.
|
||||||
|
If
|
||||||
|
.Ev $EDITOR
|
||||||
|
is not set,
|
||||||
|
.Xr nano 1
|
||||||
|
is called.
|
||||||
|
.
|
||||||
|
.Ss Flags
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Fl v
|
||||||
|
Verbose logging.
|
||||||
|
If there's an error, hopefully something useful will be included in
|
||||||
|
.Pa /tmp/clinte_$USER.log
|
||||||
|
.It Fl l Ar length
|
||||||
|
Specify the line length for wrapping post bodies.
|
||||||
|
Defaults to 80.
|
||||||
|
If the value passed is below 10, line wrapping will be disabled.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Ss Commands
|
||||||
|
.Bl -tag -width Ds
|
||||||
|
.It Cm post
|
||||||
|
Compose a new post to add to the notes board.
|
||||||
|
.
|
||||||
|
.It Cm update Op Ar id
|
||||||
|
Edit the post numbered
|
||||||
|
.Ar id
|
||||||
|
if it was previously composed by the user.
|
||||||
|
If
|
||||||
|
.Ar id
|
||||||
|
is omitted, the user will be prompted for it.
|
||||||
|
.
|
||||||
|
.It Cm delete Op Ar id
|
||||||
|
Remove a post numbered
|
||||||
|
.Ar id
|
||||||
|
if it was previously composed by the user.
|
||||||
|
If
|
||||||
|
.Ar id
|
||||||
|
is omitted, the user will be prompted for it.
|
||||||
|
.El
|
||||||
|
.
|
||||||
|
.Ss Files
|
||||||
|
Posts are stored chronologically in a file located at
|
||||||
|
.Pa /usr/local/clinte/clinte.json
|
||||||
|
.Pp
|
||||||
|
The format of the file is as follows:
|
||||||
|
.
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
{
|
||||||
|
"posts": [
|
||||||
|
{
|
||||||
|
"title": "sample title",
|
||||||
|
"author": "sample author",
|
||||||
|
"body": "sample body"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
.Ed
|
||||||
|
.
|
||||||
|
.
|
||||||
|
.Ss Notifications
|
||||||
|
.Nm
|
||||||
|
installs a script to
|
||||||
|
.Pa /etc/profile.d/
|
||||||
|
which notifies you of unseen posts upon logging in.
|
||||||
|
However, some people may find this behavior to be annoying.
|
||||||
|
To suppress notifications,
|
||||||
|
.Xr touch 1
|
||||||
|
.Pa $HOME/.hushclinte .
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An gbmor Aq Mt ben@gbmor.dev
|
||||||
|
.Sh BUGS
|
||||||
|
Send a message to the mailing list:
|
||||||
|
.Mt ~gbmor/clinte@lists.sr.ht
|
||||||
|
.Pp
|
||||||
|
You may also open a ticket at:
|
||||||
|
.Lk https://todo.sr.ht/~gbmor/clinte
|
||||||
|
.Pp
|
||||||
|
Or, /msg gbmor on tilde.chat or freenode.
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This is called in the Makefile.
|
||||||
|
|
||||||
|
if [ ! -e 'target/release/clinte' ]; then
|
||||||
|
printf '\n%s "%s"\n\n' 'Please build clinte first:' 'make'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PREFIX="$1"
|
||||||
|
BINDIR="$PREFIX/bin"
|
||||||
|
DBDIR="$PREFIX/clinte"
|
||||||
|
OS=$(uname)
|
||||||
|
BINGRP='root'
|
||||||
|
FILEGRP='root'
|
||||||
|
|
||||||
|
printf '\n%s\n' 'Installing clinte...'
|
||||||
|
printf '\n%s\n' 'Creating directories...'
|
||||||
|
|
||||||
|
mkdir -p "$DBDIR"
|
||||||
|
|
||||||
|
printf '\n%s\n' 'Copying files...'
|
||||||
|
|
||||||
|
if [ "$OS" = 'OpenBSD' ]; then
|
||||||
|
BINGRP='bin'
|
||||||
|
FILEGRP='wheel'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install -m755 -o root -g "$BINGRP" target/release/clinte "$BINDIR"
|
||||||
|
|
||||||
|
if [ -f "$DBDIR/clinte.json" ]; then
|
||||||
|
printf '\n%s\n' 'clinte.json exists. Skipping ...'
|
||||||
|
else
|
||||||
|
install -m666 -o root -g "$FILEGRP" clinte.json "$DBDIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d /etc/profile.d ]; then
|
||||||
|
printf '%s\n' 'Installing check_new_clinte_posts.sh to /etc/profile.d'
|
||||||
|
install -m644 -o root -g "$FILEGRP" check_new_clinte_posts.sh /etc/profile.d/
|
||||||
|
fi
|
||||||
|
|
||||||
|
install -m644 -o root -g "$FILEGRP" clinte.1 "$PREFIX/share/man/man1/"
|
||||||
|
|
||||||
|
printf '\n%s\n' '...Done!'
|
Loading…
Reference in New Issue