Prepare for remote upload

This commit is contained in:
Marty Oehme 2021-10-31 19:15:09 +01:00
parent d93316628a
commit cb742395cc
Signed by: Marty
GPG Key ID: B7538B8F50A1C800
4 changed files with 282 additions and 4 deletions

180
.gitignore vendored Normal file
View File

@ -0,0 +1,180 @@
# Created by https://www.toptal.com/developers/gitignore/api/vim,linux,python
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,linux,python
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# End of https://www.toptal.com/developers/gitignore/api/vim,linux,python

13
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,13 @@
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
stages:
- test
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
MIT License
Copyright (c) 2021 Marty Oehme
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.

View File

@ -1,7 +1,20 @@
# Taskwarrior - jrnl task ingestion
# jrnlwarrior - taskwarrior and jrnl cross-pollination
This little script allows simple interaction between `taskwarrior` and a `jrnl` file.
It parses the `jrnl` file and logs accomplished tasks in `taskwarrior`.
It parses the `jrnl` file and transfers accomplished and unfinished tasks to `taskwarrior`,
as well as adding today's tasks as an entry to the `jrnl` file.
More specifically, it:
* transfers completed tasks to `taskwarrior` by logging them and removes the lines from this file\
(marked with `[x] ` or `x ` at the beginning of the line)
* transfers incomplete tasks to `taskwarrior` by adding them as new tasks scheduled at the date of the entry they appear under\
(marked with an empty `[ ] ` at the beginning of their line)
* adds an entry for today's date if none exists yet and populates it with due/overdue tasks from `taskwarrior`
All three of these operations *only* operate on entries which are marked with a special title (`todotxt` by default),
though this can be changed through a regex option.
That means, it is also entirely possible to have other entries (with the same date) which will simply be ignored by the script.
To accomplish this it borrows a little from the [todo.txt](http://todotxt.org/) syntax ---
namely the idea of (A) (B) (C) prioritization and `x task done syntax`
@ -13,10 +26,60 @@ Point the file to your `jrnl` file (ideally it needs to be a single file) and
set the syntax which declares a `todo` entry within it.
```bash
./open-todo-txt.py -f ~/.local/share/jrnl/journal.txt -b 'todotxt'
./jrnlwarrior.py -f ~/.local/share/jrnl/journal.txt -b 'todotxt'
```
The commandline above sets the script to work on a specific `jrnl` file
The command above sets the script to work on a specific `jrnl` file
and only work on entries which have exactly `todotxt` as their title.
The settings above are also the default settings of the script.
**BE AWARE** that this script *actively changes* your `jrnl` file during normal operations.
If you are afraid of destructive operations, you have two options:
Create a backup of your `jrnl` file before running this script to be able to `diff` the two afterwards.
Or, to see what the program would do without actually implementing any changes,
invoke dry run mode:
```bash
./jrnlwarrior.py -n
```
It will spit out a list of tasks that are added to `taskwarrior`,
as well as its own options,
lines to be removed from the file and any to-do entries added to the file.
It will not change your `jrnl` file in any way.
If you want to switch off one of the three ways this script connects the two,
you can use the `-L`, `-I`, `-T` options which turn off logging, adding, or creating entries respectively.
```bash
./jrnlwarrior.py -I -T
```
The above invocation will *only* log completed tasks to `taskwarrior`.
Adding new to-dos and creating today entries is turned off.
```bash
./jrnlwarrior.py -T
```
This will create a one-way connection to `taskwarrior`,
by transferring both new and completed tasks to the program.
However, tasks to be done today will not be transferred back to this file.
## Scope
This was a fun weekend project and it shines through ---
the code got increasingly spaghetti towards the end (especially entry-adding to `jrnl` file was one Sunday night hour),
it's not packaged particularly well
and there are no tests of any kind implemented.
I am happily using the script in my daily workflow,
however some assumptions are made and edge cases will happen at some point.
Please don't run it willy-nilly on a long-treasured `jrnl` file without having proper backups.
Otherwise, there is no clear road-map ---
mostly, I think, the code should be cleaned up and a way found that handles `taskwarrior` task duplication better (with `uuid` or `description` comparisons or similar means).
I will probably not be able to devote much more time to this in the foreseeable future,
but if you find an issue tell me nonetheless or, even better,
see if you can spot how to fix it and I will gladly merge the changes in!