Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow parameters for todo.sh default action #407

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Commits on Apr 8, 2015

  1. Configuration menu
    Copy the full SHA
    9b46037 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2023

  1. Added test and docstring

    chrysle committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    c958319 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7b04315 View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2023

  1. Actually test (and fix) that the default action parameter is received…

    … by the action
    
    The foo2 action needs to print its parameters (minus the first which is the action name, instead of hard-coding "foo" if no parameters are passed (which also is broken because the $# is already expanded in the here-doc)), and the test needs to include "foo" (instead of "bar") to match the (reused) expected output.
    inkarkat committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    6cc8217 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2023

  1. Also handle special characters (that need escaping) in the default ac…

    …tion
    
    Spaces, quotes, $, and other special shell characters need to be escaped inside the TODOTXT_DEFAULT_ACTION, and consequently eval() used to parse that back into individual arguments.
    inkarkat committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    3ed6b48 View commit details
    Browse the repository at this point in the history
  2. FIX: Default action with arguments does not consider built-in commands

    Only $TODO_ACTIONS_DIR/$action, not even the $TODO_ACTIONS_DIR/$action/$action variant.
    A totally different approach is needed: Instead of parsing off the first argument and treating that as the custom action, do a recursive invocation with the default action parsed as a command-line. A new isDefaultAction flag is needed so that we only do this when the default action actually applies (otherwise, strange invocations like todo.sh "add +project here" would also be possible). The condition for non-empty $TODOTXT_DEFAULT_ACTION avoids an endless loop.
    inkarkat committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    0532485 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e71eb46 View commit details
    Browse the repository at this point in the history