Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
robwhitaker committed Jan 12, 2020
0 parents commit bf4e6ef
Show file tree
Hide file tree
Showing 11 changed files with 453 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
result
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Revision history for hasknote

## 0.1.0.0 -- 2020-01-12

* First version. Released on an unsuspecting world.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Robert Whitaker

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
hasknote
========

A Haskell clone of [tasknote](https://github.com/mikebobroski/tasknote) with extra features and nicer configuration. It allows the user to associate a text file with a [Taskwarrior](https://taskwarrior.org/) task. When a note is added, the task will be annotated with the first line of the note. This annotation will be updated with each call to `hasknote edit`.

## Installation

### Building with Nix

Using the [Nix package manager](https://nixos.org/nix/):

1. Clone the project and `cd` into its directory.
2. Run `nix build`
3. The compiled executable will be located at `./result/bin/hasknote`.

### Building with Cabal

Using Haskell's [Cabal](https://www.haskell.org/cabal/):

1. Clone the project and `cd` into its directory.
2. Run `cabal --enable-nix v1-configure && cabal --enable-nix v1-build`.
3. The compiled executable will be located at `./dist/build/hasknote/hasknote`.

## Usage

```
Usage: hasknote TASK_ID COMMAND
Available options:
-h,--help Show this help text
Available commands:
edit [--stdin] Create or edit a note for a task, optionally reading
from stdin instead of opening an editor
view View the note for a task if it exists
remove Remove the note for a task if it exists
```

## Configuration

You can configure hasknote via a `~/.hasknoterc` file. Options are:

- `editor` - The text editor you edit your note in. Default: `editor = vi`.
- `viewer` - The program used to view your note. Default: `viewer = cat`.
- `location` - The directory where your notes will be stored. If the directory does not exist, it will be created. Default: `location = ~/.task/notes`.
- `extension` - The file extension for your notes. Default: `extension = .txt`.
- `prefix` - The prefix of hasknote's task annotations, used by hasknote to detect and remove the annotations later. Default: `prefix = [hasknote]`.
2 changes: 2 additions & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
17 changes: 17 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ compiler ? null
, pkgs ? import <nixpkgs> {}
}:

let
haskellPackages =
if builtins.isNull compiler
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
overriddenPackages = haskellPackages.override {
overrides = self: super: {
taskwarrior =
self.callPackage ./taskwarrior.nix {};
};
};
in
overriddenPackages.callCabal2nix "hasknote" ./. {}
47 changes: 47 additions & 0 deletions hasknote.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: hasknote
version: 0.1.0.0
license: MIT
license-file: LICENSE
copyright: (c) 2020 Rob Whitaker
category: CLI
author: Rob Whitaker
maintainer: Rob Whitaker <[email protected]>
cabal-version: >= 1.10
synopsis: A Haskell implementation of Tasknote for Taskwarrior.
-- homepage:
-- bug-reports:
build-type: Simple

extra-source-files:
CHANGELOG.md
README.md

executable hasknote
main-is: Main.hs
default-extensions: OverloadedStrings
, GeneralizedNewtypeDeriving
ghc-options: -Wall
-fwarn-incomplete-uni-patterns
-fwarn-tabs
-fwarn-incomplete-record-updates
-fno-warn-missing-signatures
-fno-warn-type-defaults
-Werror
-Wwarn=unused-imports
-Wwarn=unused-local-binds
-Wwarn=unused-matches
-Wwarn=unused-do-bind
build-depends: base
, config-ini
, data-default
, directory
, filepath
, mtl
, optparse-applicative
, process
, taskwarrior
, text
, time
, uuid
hs-source-dirs: src
default-language: Haskell2010
9 changes: 9 additions & 0 deletions pinned-packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
pkgs1909 = fetchTarball {
url = https://github.com/NixOS/nixpkgs/archive/19.09.tar.gz;
sha256 = "0mhqhq21y5vrr1f30qd2bvydv4bbbslvyzclhw0kdxmkgg3z4c92";
};
in
{
pkgs1909 = import pkgs1909 {};
}
13 changes: 13 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let
pkgs = (import ./pinned-packages.nix).pkgs1909;
drv = import ./. { inherit pkgs; };
in
pkgs.haskellPackages.shellFor {
packages = p: [drv];
buildInputs = with pkgs.haskellPackages; [
cabal-install
ghcid
stylish-haskell
hlint
];
}
Loading

0 comments on commit bf4e6ef

Please sign in to comment.