Coder Social home page Coder Social logo

jarun / pdd Goto Github PK

View Code? Open in Web Editor NEW
372.0 10.0 18.0 236 KB

:date: Tiny date, time diff calculator with piggybacked timers

License: GNU General Public License v3.0

Python 76.60% Roff 13.86% Makefile 3.83% Shell 5.71%
datetime command-line terminal calculator timer stopwatch countdown-timer console date-time cli

pdd's Introduction

  • author of buku, nnn, googler...
  • writes high quality tools to optimize productivity
  • wrote them to minimize time at a computer

pdd's People

Contributors

bwagner avatar dmarcoux avatar freed-wu avatar jarun avatar jeremypress avatar maxice8 avatar mosrod avatar run-ze avatar santilococo avatar scarabeusiv avatar txgk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdd's Issues

How to use the zsh_completion.py script ?

Hi,

I'm trying to update pdd (pdd-git) to V1.6 on the AUR but I'm struggling with the zsh completion.

For ddgr (which I also maintain on the AUR), the _ddgr file for zsh completion is already provided in the archive, but with pdd I have to generate the _pdd file myself during the packaging process by executing the zsh_completion.py, is that right ?

If that's so, I cannot seems to make it work... Here the result I get:
python zsh_completion.py

Traceback (most recent call last):
  File "/tmp/pdd/src/pdd/auto-completion/zsh/zsh_completion.py", line 121, in <module>
    parser = __import__(PACKAGE).get_parser()
ModuleNotFoundError: No module named 'pdd'

Unfortunately, I'm not good enough with python to find my way out.

Can you help me generating the zsh completion file ?
Thanks in advance !

BTW, thanks for your awesome works :)

[advice] Change shtab

I propose use some library like https://docs.iterative.ai/shtab to generate shell completion. Just

pdd --print-completion XXX

Maybe easier. One hard problem is shtab doesn't support generate shell completion for nargs > 1.
I advise change pdd -d yyyy mmm dd to pdd -d yyyy-mmm-dd to avoid this problem.

Advantage:

Disadvantage:

  • Break the compatibility

pip install ppd fails for python 3.10.4 and 3.10.8 on macOS 12.6 (Monterey)

pip install ppd fails for python 3.10.4 and 3.10.8 on macOS 12.6 (Monterey) with FileNotFoundError: [Errno 2] No such file or directory: 'pdd'

Workaround: Downloading the zip-file and installing with pip install pdd-master.zip succeeds.

Transcript:

pip install pdd
Collecting pdd
  Using cached pdd-1.6.tar.gz (22 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/88/ycwg1tqn27q6xc2h7whfx8d00000gp/T/pip-install-3zwkde0k/pdd_39109a313a5d4095bced56f61a637d7d/setup.py", line 9, in <module>
          shutil.copyfile('pdd', 'pdd.py')
        File "/Users/.../.asdf/installs/python/3.10.8/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 254, in copyfile
          with open(src, 'rb') as fsrc:
      FileNotFoundError: [Errno 2] No such file or directory: 'pdd'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

diff default to today

Hi @jarun and thank you for all your delightful tools.

I often find myself looking for the number of days remaining from today to X.

Right now, I can get it as follow:

$ pdd -d 2020 Jul 5 $(date +"%Y %b %d")
0y 2m 26d
87d

But it would be simpler to just type:

$ pdd -d 2020 Jul 5
usage: pdd [-h] [-d yyyy mmm dd [yyyy mmm dd | y m d]] [-t hh:mm:ss [hh:mm:ss | h:m:s]] [--add] [--sub] [--day yyyy mmm dd] [-c hh:mm:ss] [-r command] [-s [resolution]] [-q] [keywords [keywords ...]]
pdd: error: argument -d: expected 6 arguments

Can you make it so that if only 3 arguments are given to pdd -d, the remaining 3 are auto-evaluated to today?

Can it "add" more than two timestamps?

First thanks for this very helpful tool,
i frequently need to determine the differences between two timestamps
and this tool really helps me!

about the --add option, can it work with more than two timestamps ?
e.g

pdd -t 00:01:00 00:02:00 00:03:00 --add

results:

00:03:00
180s
08:11:54
29514s

expected results:

00:06:00
360s

or if there another workflow/approach i will be grateful.

note: my plan is to add dozens of timestamps, not just three. thanks in advance

Customizable time/date diff output

Hi @jarun, thanks a ton for a very useful tool!

As I understand it, pdd (the command line tool) currently only outputs the time difference In the following format:

%02d:%02d:%02d
%ds

I was wondering if it would be possible to add an option to change that on run time.

Thanks a ton!

pypi invitation

hi, i just realized you invited me on pypi for this project

unfortunately i have to decline it because i have less interest for this project.

python 3.8 problem

Update to python3.8 seems to have broken pdd


$ pdd
Traceback (most recent call last):
  File "/usr/local/bin/pdd", line 29, in <module>
    from dateutil.relativedelta import relativedelta
ModuleNotFoundError: No module named 'dateutil'
$ ln -s python3.7m.exe python3
$ pdd
Sun 2021 Jan 10 00:41:02 EST

Add MANIFEST.in

This file is needed to include the LICENSE and CHANGELOG files in the PyPI package.

Use ISO 8601 format [YYYY MM DD] in dates

Though it's well documented, the utility should follow standards.

This would be done just before the next release so users of the current release are not confused.

Windows support may be limited

FYI:

lib\python\python lib\pdd\pdd.py
Traceback (most recent call last):
File "lib\pdd\pdd.py", line 412, in
main()
File "lib\pdd\pdd.py", line 244, in main
args = parse_args()
File "lib\pdd\pdd.py", line 237, in parse_args
t.tm_hour, t.tm_min, t.tm_sec, t.tm_zone))
AttributeError: 'time.struct_time' object has no attribute 'tm_zone'

new pypi release

Hi, is there any work needed to publish a new pypi release? (I'm running into the shutil.copy issue in setup.py from an outdated release)

btw, this project looks awesome

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.