diff -ur tasksh-1.0.0/AUTHORS tasksh-1.2.0/AUTHORS --- tasksh-1.0.0/AUTHORS 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/AUTHORS 2017-05-10 00:46:36.000000000 +0300 @@ -3,10 +3,14 @@ Paul Beckingham (Principal Author) Federico Hernandez (Principal Author) + Dirk Deimeke (Technical Advisor & Evangelist) The following submitted code, packages or analysis, and deserve special thanks: - None - it's too new + Jörg Krause + Ben Boeckel + ilove zfs + Paul Fenwick Thanks to the following, who submitted detailed bug reports and excellent suggestions: @@ -15,4 +19,10 @@ Fidel Mato David Stahl David Patrick + jonbobbly + hosaka + Lars Kumbier + Iain R. Learmonth + Eric Hymowitz + bjonnh diff -ur tasksh-1.0.0/ChangeLog tasksh-1.2.0/ChangeLog --- tasksh-1.0.0/ChangeLog 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/ChangeLog 2017-05-10 01:02:27.000000000 +0300 @@ -1,13 +1,50 @@ +1.2.0 (2017-05-10) - + +- TS-29 tasksh hangs trying to read task from stdin + (thanks to ilove zfs). +- TS-32 control-d to exit + (thanks to Eric Hymowitz, Paul Fenwick). +- TS-34 Tasksh throw a warning at the end of a review command + (thanks to bjonnh). +- Review report now defaults to 6 days instead of 1 weeķ, which is more + convenient for those who review weekly + (thanks to Dirk Deimeke). + +------ current release --------------------------- + +1.1.0 (2016-09-06) 464f5ae19f853911e739c2489897aef64345c388 + +- TD-120 Missing cmakedefine for HAVE_GET_CURRENT_DIR_NAME + (Thanks to Jörg Krause, Ben Boeckel). +- TW-1845 Cygwin build fails, missing get_current_dir_name + (thanks to hosaka). +- TS-11 Autoclear in the Task Shell + (thanks to Lars Kumbier). +- TS-24 add review option (m)odify + (thanks to David Patrick). +- TS-28 Please add a (m)odify feature for review + (thanks to Iain R. Learmonth). +- Implemented 'review' command. +- Implemented 'diag' command. +- Added 'review N' option, to specify the number of tasks you would like to + review. +- Integrated libshared.git. + +------ old releases ------------------------------ + 1.0.0 (2014-12-21) 5934dfcefac6d037a359bc733a8382e42e32552e -- TS-1 Apostrophe inside tasksh 'log' causes segmentation fault (thanks to - David Stahl). -- TS-2 tasksh segfaults if quotes not closed (thanks to Fidel Mato). -- TS-5 tasksh segfaults (thanks to David Patrick). -- TS-13 Quotes included when using task shell (thanks to Kevin Gunn). +- TS-1 Apostrophe inside tasksh 'log' causes segmentation fault + (thanks to David Stahl). +- TS-2 tasksh segfaults if quotes not closed + (thanks to Fidel Mato). +- TS-5 tasksh segfaults + (thanks to David Patrick). +- TS-13 Quotes included when using task shell + (thanks to Kevin Gunn). - libreadline support added for line editing and command history. -Project started 2014-06-08 - ------ start ----------------------------------- +Project started 2014-06-08 + Только в tasksh-1.2.0/cmake: CXXSniffer.cmake Только в tasksh-1.2.0: cmake.h diff -ur tasksh-1.0.0/cmake.h.in tasksh-1.2.0/cmake.h.in --- tasksh-1.0.0/cmake.h.in 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/cmake.h.in 2017-05-10 00:46:36.000000000 +0300 @@ -47,3 +47,14 @@ /* Found wordexp.h */ #cmakedefine HAVE_WORDEXP +/* Found tm.tm_gmtoff struct member */ +#cmakedefine HAVE_TM_GMTOFF + +/* Found st.st_birthtime struct member */ +#cmakedefine HAVE_ST_BIRTHTIME + +/* Functions */ +#cmakedefine HAVE_GET_CURRENT_DIR_NAME +#cmakedefine HAVE_TIMEGM +#cmakedefine HAVE_UUID_UNPARSE_LOWER + diff -ur tasksh-1.0.0/CMakeLists.txt tasksh-1.2.0/CMakeLists.txt --- tasksh-1.0.0/CMakeLists.txt 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/CMakeLists.txt 2017-05-10 00:46:36.000000000 +0300 @@ -1,48 +1,16 @@ cmake_minimum_required (VERSION 2.8) -set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required - -include (CheckFunctionExists) -include (CheckStructHasMember) - +set (CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set (HAVE_CMAKE true) project (tasksh) -set (PROJECT_VERSION "1.0.0") +include (CXXSniffer) -if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set (LINUX true) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set (DARWIN true) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD") - set (KFREEBSD true) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") - set (FREEBSD true) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") - set (OPENBSD true) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") - set (NETBSD true) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (SOLARIS true) -elseif (${CMAKE_SYSTEM_NAME} STREQUAL "GNU") - set (GNUHURD true) -else (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set (UNKNOWN true) -endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - -if (NETBSD) - # Since readline, etc likely to be in /usr/pkg/lib, not standard library - # Otherwise will remove links during install - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -endif (NETBSD) +set (PROJECT_VERSION "1.2.0") -if (FREEBSD) -SET (TASKSH_MAN1DIR man/man1 CACHE STRING "Installation directory for man pages, section 1") -else (FREEBSD) -SET (TASKSH_MAN1DIR share/man/man1 CACHE STRING "Installation directory for man pages, section 1") -endif (FREEBSD) -SET (TASKSH_DOCDIR share/doc/tasksh CACHE STRING "Installation directory for doc files") -SET (TASKSH_RCDIR "${TASKSH_DOCDIR}/rc" CACHE STRING "Installation directory for configuration files") -SET (TASKSH_BINDIR bin CACHE STRING "Installation directory for the binary") +include (CheckFunctionExists) +include (CheckStructHasMember) +include (CheckCXXCompilerFlag) message ("-- Looking for SHA1 references") if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index) @@ -63,13 +31,14 @@ set (PACKAGE_VERSION "${VERSION}") set (PACKAGE_STRING "${PACKAGE} ${VERSION}") -message ("-- Looking for pthread") -find_package (Threads) -if (THREADS_FOUND) - set (HAVE_LIBPTHREAD true) - set (TASKD_INCLUDE_DIRS ${TASKD_INCLUDE_DIRS} ${THREADS_INCLUDE_DIR}) - set (TASKD_LIBRARIES ${TASKD_LIBRARIES} ${THREADS_LIBRARIES}) -endif (THREADS_FOUND) +if (FREEBSD) +SET (TASKSH_MAN1DIR man/man1 CACHE STRING "Installation directory for man pages, section 1") +else (FREEBSD) +SET (TASKSH_MAN1DIR share/man/man1 CACHE STRING "Installation directory for man pages, section 1") +endif (FREEBSD) +SET (TASKSH_DOCDIR share/doc/tasksh CACHE STRING "Installation directory for doc files") +SET (TASKSH_RCDIR "${TASKSH_DOCDIR}/rc" CACHE STRING "Installation directory for configuration files") +SET (TASKSH_BINDIR bin CACHE STRING "Installation directory for the binary") # include the readline library finder module set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules") @@ -83,15 +52,6 @@ set (TASKSH_LIBRARIES ${TASKSH_LIBRARIES} ${READLINE_LIBRARIES}) endif (READLINE_FOUND) -# Set the package language. -if (LANGUAGE) - set (PACKAGE_LANGUAGE ${LANGUAGE}) -else (LANGUAGE) - set (PACKAGE_LANGUAGE 1) -endif (LANGUAGE) - -set (LANGUAGE_ENG_USA 1) - message ("-- Configuring cmake.h") configure_file ( ${CMAKE_SOURCE_DIR}/cmake.h.in @@ -103,7 +63,7 @@ add_subdirectory (test EXCLUDE_FROM_ALL) endif (EXISTS ${CMAKE_SOURCE_DIR}/test) -set (doc_FILES NEWS ChangeLog README.md INSTALL AUTHORS COPYING) +set (doc_FILES NEWS ChangeLog INSTALL AUTHORS COPYING) foreach (doc_FILE ${doc_FILES}) install (FILES ${doc_FILE} DESTINATION ${TASKSH_DOCDIR}) endforeach (doc_FILE) @@ -114,6 +74,6 @@ set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION}) set (CPACK_SOURCE_IGNORE_FILES "CMakeCache" "CMakeFiles" "CPackConfig" "CPackSourceConfig" "_CPack_Packages" "cmake_install" "install_manifest" "Makefile$" - "test" "package-config" "misc/*" "src/tasksh$" - "/\\.gitignore" "/\\.git/" "swp$") + "test" "package-config" "misc/*" "src/tasksh$" "README.md" + "/\\\\.gitignore" "/\\\\.git/" "swp$") include (CPack) Только в tasksh-1.2.0: commit.h diff -ur tasksh-1.0.0/COPYING tasksh-1.2.0/COPYING --- tasksh-1.0.0/COPYING 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/COPYING 2017-05-10 00:46:36.000000000 +0300 @@ -1,6 +1,6 @@ tasksh - a shell/frontend for the command line task list manager taskwarrior. -Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez. +Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal Только в tasksh-1.0.0/doc/man: .gitignore Только в tasksh-1.2.0/doc/man: tasksh.1 diff -ur tasksh-1.0.0/doc/man/tasksh.1.in tasksh-1.2.0/doc/man/tasksh.1.in --- tasksh-1.0.0/doc/man/tasksh.1.in 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/doc/man/tasksh.1.in 2017-05-10 01:03:24.000000000 +0300 @@ -1,22 +1,23 @@ -.TH tasksh 1 2014-12-21 "${PACKAGE_STRING}" "User Manuals" +.TH tasksh 1 2017-05-10 "${PACKAGE_STRING}" "User Manuals" .SH NAME tasksh \- Interactive taskwarrior shell .SH SYNOPSIS -.B tasksh [] +.B tasksh .br .B tasksh --version -.br -.B tasksh --help .SH DESCRIPTION -The tasksh program can be used to create a more immersive taskwarrior -environment. Any task command you run outside the shell can also be run inside +Tasksh can be used to create a more immersive taskwarrior environment. +Any task command you run outside the shell can also be run inside the shell, without the need to prefix every command with "task". When built with libreadline, tasksh provides command editing and history. +Tasksh has an integrated 'review' command that leads you through an interactive +review session. + Tasksh supports all recent versions of Taskwarrior. .SH COMMANDS @@ -24,12 +25,46 @@ Taskwarrior. .TP -.B exit/quit/Ctrl-D -These commands cause tasksh to terminate. +.B diagnostics +Displays settings pertinent to tasksh, for diagnosing problems. .TP -.B diagnostics -Displays settings pertinent to tasksh. +.B exec +This command allows you to run shell commands from within Tasksh. This is ideal +for accessing man pages such as this. The '!' command can be used in place of +the 'exec' keyword. Once the command is run, control returns to Tasksh. + +.TP +.B exit/quit +These commands cause tasksh to terminate, returning you to your system shell. + +.TP +.B help +Shows a summary of commands, and how to obtain help. + +.TP +.B review [N] +Begins an interactive review session, where you can mark tasks as reviewed, +edit them using your text editor, provide modification commands, or skip them. +You can terminate a review session at any time, and the next review session +will resume at the right place. + +To find tasks needing review, the '_reviewed' custom report is created and run, +which filters tasks that have a missing 'reviewed' UDA date, or have not been +reviewed for a week. + +This means that if you run a review session to completion, there will be no +need to review again for a week, and the review command will simply do nothing +until then. + +The one week review cycle is defined by the '_reviewed' custom report, which +can be modified if you prefer a monthly review cycle. + +If 'N' is provided, the session is limited to reviewing only N tasks. + +Note: requires Taskwarrior 2.5.0 or later. +For full details, see: + .SH USAGE Here is an example tasksh session. @@ -74,11 +109,11 @@ .br --------------------------------------------------------------------- .br - 2 party H 10/17/2010 2 hrs Select and book a venue + 2 party H 10/17/2015 2 hrs Select and book a venue .br - 5 party H 10/22/2010 2 hrs Design invitations + 5 party H 10/22/2015 2 hrs Design invitations .br - 9 home 10/31/2010 1 hr Pay rent + 9 home 10/31/2015 1 hr Pay rent .br 3 party 2 hrs Mail invitations .br @@ -95,8 +130,21 @@ $ .br +.SH CONFIGURATION +Tasksh piggybacks on Taskwarrior's .taskrc configuration file, and refers +to settings there. If you use a non-standard location for your .task database +, and .taskrc file, Tasksh will not find them unless you set the TASKDATA and +TASKRC environment variables. See 'man taskrc' for more details. + +The review command storeѕ a UDA ('reviewed') and report definition ('_reviewed'). + +.TP +.B tasksh.autoclear=1 +If set to "1", causes each tasksh command to be preceded by a 'clear screen' and +cursor reset. Default is "0". + .SH "CREDITS & COPYRIGHTS" -Copyright (C) 2006 \- 2014 P. Beckingham, F. Hernandez. +Copyright (C) 2006 \- 2017 P. Beckingham, F. Hernandez. This man page was originally written by Federico Hernandez. Только в tasksh-1.2.0: .gitmodules diff -ur tasksh-1.0.0/INSTALL tasksh-1.2.0/INSTALL --- tasksh-1.0.0/INSTALL 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/INSTALL 2017-05-10 00:46:36.000000000 +0300 @@ -1,37 +1,131 @@ Installation Instructions ------------------------- -Please follow the instructions below to build tasksh with cmake. +Please follow the instructions below to build and install tasksh from source. -Pre-requisites --------------- +Dependencies +------------ + +You will need the CMake build system installed in order to build tasksh from +source. Information on cmake can be obtained at http://cmake.org -You will need the CMake build system installed in order to build tasksh -from source. +Additionally, you will need: -More information on cmake can be obtained at http://cmake.org + libreadline Basic Installation ------------------ +Briefly, these shell commands will unpack, build and install Tasksh: + + $ tar xzf tasksh-X.Y.Z.tar.gz [1] + $ cd tasksh-X.Y.Z [2] + $ cmake -DCMAKE_BUILD_TYPE=release . [3] + $ make [4] + $ sudo make install [5] + $ cd .. ; rm -r tasksh-X.Y.Z [6] + +These commands are explained below: + + 1. Unpacks the source tarball. This creates the directory tasksh-X.Y.Z, + containing all the code. + + 2. Change directory to the root of the distribution. + + 3. Invokes CMake to scan for dependencies and machine-specific details, then + generate the makefiles. Requests an optimized build, which will run faster + and be more compact. This may take a minute. + + 4. Builds tasksh. This may take a minute. + + 5. Installs the program, documentation and other data files. + + 6. Removes the temporary directory. + + Build and configurations options -------------------------------- -Localizations -------------- +You can customize the configuration run with cmake variables. This will modify +the installation process: + +To change the installation directory you use the following configuration +variable: + + $ cmake -DCMAKE_INSTALL_PREFIX= . + +cmake configuration variables are applied with the -D option and consist of a + and a : + + $ cmake -D= . + +Four more variables can customize the installation process. The following table +lists them and their defaults plus the CMAKE_INSTALL_PREFIX: + + CMAKE_INSTALL_PREFIX /usr/local + TASKSH_BINDIR bin + TASKSH_DOCDIR share/doc/tasksh + TASKSH_MAN1DIR share/man/man1 + +The corresponding TASKSH_* variables will be combined with CMAKE_INSTALL_PREFIX to +get absolute installation directories: + + CMAKE_INSTALL_PREFIX/TASKSH_BINDIR /usr/local/bin + CMAKE_INSTALL_PREFIX/TASKSH_DOCDIR /usr/local/share/doc/tasksh + CMAKE_INSTALL_PREFIX/TASKSH_MAN1DIR /usr/local/share/man/man1 + Uninstallation -------------- +There is no uninstall option in CMake makefiles. This is a manual process. + +To uninstall Tasksh, remove the files listed in the install_manifest.txt file +that was generated when you built Tasksh. + + Tasksh Build Notes ----------------------- +Tasksh has dependencies that are detected by CMake in almost all cases, but +there are situations and operating systems that mean you will need to offer a +little help. + +If Tasksh will not build on your system, first take a look at the Operating +System notes below. If this doesn't help, then go to the Troubleshooting +section, which includes instructions on how to contact us for help. + + Operating System Notes ---------------------- +Cygwin + If 'make install' fails when writing to the /usr/local/share/ directory, + this may be because your current login doesn't have permission to write + to the Windows directory containing your Cygwin installation. Either + login to Windows as an Administrator and try the 'make install' process + again, or reinstall Cygwin under your normal Windows login. + + Troubleshooting --------------- +If you've recently made changes to dependencies (by reinstalling them, for +example) be sure to rerun 'cmake .' before trying to execute 'make' again. + +CMake will run and locate all the necessary pieces for the build, and create +a Makefile. There may be errors and warnings when running CMake, or there +may be compiler errors and warnings when running 'make'. Sometimes you will run +CMake with no reported problems, and the build will fail later. This is +almost always because CMake is mistaken about some assumption. + +If a build does not succeed, please send the contents of the 'CMakeCache.txt' +and 'CMakeFiles/CMakeOutput.log' files to support@taskwarrior.org. + +If CMake runs but tasksh does not build, please send the contents of the above +files as well as a transcript from the build, which is not written to a file +and must be captured from the terminal. + --- diff -ur tasksh-1.0.0/LICENSE tasksh-1.2.0/LICENSE --- tasksh-1.0.0/LICENSE 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/LICENSE 2017-05-10 00:46:36.000000000 +0300 @@ -1,6 +1,6 @@ tasksh - a shell/frontend for ithe command line task list manager taskwarrior. -Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez. +Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -ur tasksh-1.0.0/NEWS tasksh-1.2.0/NEWS --- tasksh-1.0.0/NEWS 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/NEWS 2017-05-10 00:46:36.000000000 +0300 @@ -1,37 +1,27 @@ -New Features in tasksh 1.0 +New Features in tasksh 1.2.0 - - libreadline support. Actually, the only feature. + - Responds to Ctrl-D by exiting. -New commands in tasksh 1.0 +New commands in tasksh 1.2.0 - - 'exit', 'quit' or Ctrl-D exits the shell - - 'diagnostics' shows $PATH and where it found Taskwarrior - - 'help' references the man page + - -New configuration options in tasksh 1.0 +New configuration options in tasksh 1.2.0 - - None - -Newly deprecated features in tasksh 1.0 - - - None - -Removed features in 1.0 - - - None + - Known Issues - - None + - Tasksh has been built and tested on the following configurations: - * OS X + * macOS * Fedora * Ubuntu * Debian - * Arch Linux + * Arch * FreeBSD * Cygwin Только в tasksh-1.0.0/: README.md diff -ur tasksh-1.0.0/src/CMakeLists.txt tasksh-1.2.0/src/CMakeLists.txt --- tasksh-1.0.0/src/CMakeLists.txt 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/src/CMakeLists.txt 2017-05-10 00:46:36.000000000 +0300 @@ -1,19 +1,32 @@ cmake_minimum_required (VERSION 2.8) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/libshared/src ${TASKSH_INCLUDE_DIRS}) set (tasksh_SRCS diag.cpp help.cpp prompt.cpp - Color.cpp Color.h - Path.cpp Path.h - File.cpp File.h - Directory.cpp Directory.h - text.cpp text.h) + review.cpp + shell.cpp) -add_executable (tasksh_executable main.cpp ${tasksh_SRCS}) -target_link_libraries (tasksh_executable ${TASKSH_LIBRARIES}) +set (libshared_SRCS libshared/src/Color.cpp libshared/src/Color.h + libshared/src/Datetime.cpp libshared/src/Datetime.h + libshared/src/Duration.cpp libshared/src/Duration.h + libshared/src/FS.cpp libshared/src/FS.h + libshared/src/Lexer.cpp libshared/src/Lexer.h + libshared/src/Pig.cpp libshared/src/Pig.h + libshared/src/shared.cpp libshared/src/shared.h + libshared/src/format.cpp libshared/src/format.h + libshared/src/unicode.cpp libshared/src/unicode.h + libshared/src/utf8.cpp libshared/src/utf8.h + libshared/src/wcwidth6.cpp) + +add_library (tasksh STATIC ${tasksh_SRCS}) +add_library (libshared STATIC ${libshared_SRCS}) +add_executable (tasksh_executable main.cpp) + +target_link_libraries (tasksh_executable tasksh libshared ${TASKSH_LIBRARIES}) set_property (TARGET tasksh_executable PROPERTY OUTPUT_NAME "tasksh") Только в tasksh-1.0.0/src: Color.cpp Только в tasksh-1.0.0/src: Color.h diff -ur tasksh-1.0.0/src/diag.cpp tasksh-1.2.0/src/diag.cpp --- tasksh-1.0.0/src/diag.cpp 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/src/diag.cpp 2017-05-10 00:46:36.000000000 +0300 @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // -// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez. +// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -25,14 +25,16 @@ //////////////////////////////////////////////////////////////////////////////// #include +#include #include #include #include #include #include -#include -#include -#include +#include +#include +#include +#include #ifdef HAVE_READLINE #include @@ -42,28 +44,119 @@ //////////////////////////////////////////////////////////////////////////////// int cmdDiagnostics () { - // TODO Version - // TODO Platform - // TODO pthreads - // TODO libreadline + Color bold ("bold"); + + std::cout << "\n" + << bold.colorize (PACKAGE_STRING) + << "\n" + << " " << "Platform: " << osName () + << "\n\n"; + + // Compiler. + std::cout << bold.colorize ("Compiler") + << "\n" +#ifdef __VERSION__ + << " " << "Version: " + << __VERSION__ << "\n" +#endif + << " " << "Caps:" +#ifdef __STDC__ + << " +stdc" +#endif +#ifdef __STDC_HOSTED__ + << " +stdc_hosted" +#endif +#ifdef __STDC_VERSION__ + << " +" << __STDC_VERSION__ +#endif +#ifdef _POSIX_VERSION + << " +" << _POSIX_VERSION +#endif +#ifdef _POSIX2_C_VERSION + << " +" << _POSIX2_C_VERSION +#endif +#ifdef _ILP32 + << " +ILP32" +#endif +#ifdef _LP64 + << " +LP64" +#endif + << " +c" << 8 * sizeof (char) + << " +i" << 8 * sizeof (int) + << " +l" << 8 * sizeof (long) + << " +vp" << 8 * sizeof (void*) + << " +time_t" << 8 * sizeof (time_t) + << "\n"; + + // Compiler compliance level. + std::cout << " Compliance: " + << cppCompliance () + << "\n\n"; + + std::cout << bold.colorize ("Build Features") + << "\n" + + // Build date. + << " " << "Built: " << __DATE__ << " " << __TIME__ << "\n" +#ifdef HAVE_COMMIT + << " " << "Commit: " << COMMIT << "\n" +#endif + << " CMake: " << CMAKE_VERSION << "\n"; + + std::cout << "libreadline: " +#ifdef HAVE_READLINE +#ifdef RL_VERSION_MAJOR + << RL_VERSION_MAJOR << "." << RL_VERSION_MINOR +#elif defined RL_READLINE_VERSION + << "0x" << std::hex << RL_READLINE_VERSION +#endif +#else + << "n/a" +#endif + << "\n"; + + std::cout << " Build type: " +#ifdef CMAKE_BUILD_TYPE + << CMAKE_BUILD_TYPE +#else + << "-" +#endif + << "\n\n"; + + std::cout << bold.colorize ("Configuration") + << "\n"; + + auto env = getenv ("TASKRC"); + std::cout << " TASKRC: " + << (env ? env : "") + << "\n"; + + env = getenv ("TASKDATA"); + std::cout << " TASKDATA: " + << (env ? env : "") + << "\n"; // Taskwarrior version + location std::string path (getenv ("PATH")); - std::cout << "PATH " << path << "\n"; - - std::vector paths; - split (paths, path, ':'); + std::cout << " PATH: " << path << "\n"; - std::vector ::iterator i; - for (i = paths.begin (); i != paths.end (); ++i) + for (const auto& i : split (path, ':')) { - File task (*i + "/task"); + File task (i + "/task"); if (task.exists ()) { - std::cout << "Taskwarrior " << (*i + "/task") << "\n"; + std::string input; + std::string output; + execute ("task", {"--version"}, input, output); + + std::cout << "Taskwarrior: " + << i + << "/task " + << output; // Still has \n } } + std::cout << "\n"; return 0; } Только в tasksh-1.0.0/src: Directory.cpp Только в tasksh-1.0.0/src: Directory.h Только в tasksh-1.0.0/src: eng-USA.h Только в tasksh-1.0.0/src: File.cpp Только в tasksh-1.0.0/src: File.h diff -ur tasksh-1.0.0/src/help.cpp tasksh-1.2.0/src/help.cpp --- tasksh-1.0.0/src/help.cpp 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/src/help.cpp 2017-05-10 00:46:36.000000000 +0300 @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // -// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez. +// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -26,14 +26,22 @@ #include #include -#include -#include -#include //////////////////////////////////////////////////////////////////////////////// int cmdHelp () { - std::cout << "Run 'man tasksh' for help.\n"; + std::cout << '\n' + << " Commands:\n" + << " tasksh> list Or any other Taskwarrior command\n" + << " tasksh> review [N] Task review session, with optional cutoff after N tasks\n" + << " tasksh> exec ls -al Any shell command. May also use '!ls -al'\n" + << " tasksh> help Tasksh help\n" + << " tasksh> diagnostics Tasksh diagnostics\n" + << " tasksh> quit End of session. May also use 'exit'\n" + << '\n' + << "Run 'man tasksh' from your shell prompt.\n" + << "Run '! man tasksh' from inside tasksh.\n" + << '\n'; return 0; } Только в tasksh-1.0.0/src: i18n.h Только в tasksh-1.2.0/src: liblibshared.a Только в tasksh-1.2.0/src: libshared Только в tasksh-1.2.0/src: libtasksh.a diff -ur tasksh-1.0.0/src/main.cpp tasksh-1.2.0/src/main.cpp --- tasksh-1.0.0/src/main.cpp 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/src/main.cpp 2017-05-10 00:46:36.000000000 +0300 @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // -// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez. +// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -26,11 +26,13 @@ #include #include +#include #include #include +#include #include -#include -#include +#include +#include #ifdef HAVE_READLINE #include @@ -44,16 +46,22 @@ // tasksh commands. int cmdHelp (); int cmdDiagnostics (); -std::string composePrompt (); +int cmdReview (const std::vector &, bool); +int cmdShell (const std::vector &); +std::string promptCompose (); std::string findTaskwarrior (); //////////////////////////////////////////////////////////////////////////////// -static int commandLoop () +static void welcome () { - // TODO Local data: timer, context stack. No globals. + std::cout << PACKAGE_STRING << "\n"; + cmdHelp (); +} - // Compose the prompt. - std::string prompt = composePrompt (); +//////////////////////////////////////////////////////////////////////////////// +const std::string getResponse (const std::string& prompt) +{ + std::string response {""}; // Display prompt, get input. #ifdef HAVE_READLINE @@ -61,40 +69,70 @@ if (! line_read) { std::cout << "\n"; - return -1; + response = ""; } + else + { + // Save history. + if (*line_read) + add_history (line_read); - // Save history. - if (*line_read) - add_history (line_read); - - std::string command (line_read); - free (line_read); + response = std::string (line_read); + free (line_read); + } #else std::cout << prompt; - std::string command; - std::getline (std::cin, command); + std::getline (std::cin, response); if (std::cin.eof () == 1) { std::cout << "\n"; - return -1; + response = ""; } #endif - // Dispatch command + return response; +} + +//////////////////////////////////////////////////////////////////////////////// +static int commandLoop (bool autoClear) +{ + // Compose the prompt. + auto prompt = promptCompose (); + + // Display prompt, get input. + auto command = getResponse (prompt); + + // Obey Taskwarrior's rc.tasksh.autoclear. + if (autoClear) + std::cout << "\033[2J\033[0;0H"; + int status = 0; - if (closeEnough ("exit", command, 3)) status = -1; - else if (closeEnough ("quit", command, 3)) status = -1; - else if (closeEnough ("help", command, 3)) status = cmdHelp (); - else if (closeEnough ("diagnostics", command, 3)) status = cmdDiagnostics (); + if (! isatty (fileno (stdin)) && command == "") + { + status = -1; + } else if (command != "") { - std::cout << "[task " << command << "]\n"; - command = "task " + command; - system (command.c_str ()); + auto args = split (command, ' '); + + // Dispatch command. + if (args[0] == "") status = -1; + else if (closeEnough ("exit", args[0], 3)) status = -1; + else if (closeEnough ("quit", args[0], 3)) status = -1; + else if (closeEnough ("help", args[0], 3)) status = cmdHelp (); + else if (closeEnough ("diagnostics", args[0], 3)) status = cmdDiagnostics (); + else if (closeEnough ("review", args[0], 3)) status = cmdReview (args, autoClear); + else if (closeEnough ("exec", args[0], 3) || + args[0][0] == '!') status = cmdShell (args); + else if (command != "") + { + command = "task " + command; + std::cout << "[" << command << "]\n"; + system (command.c_str ()); - // Deliberately ignoreѕ taskwarrior exit status, otherwise empty filters - // cause the shell to terminate. + // Deliberately ignoreѕ taskwarrior exit status, otherwise empty filters + // cause the shell to terminate. + } } return status; @@ -114,7 +152,22 @@ { try { - while ((status = commandLoop ()) == 0) + // Get the Taskwarrior rc.tasksh.autoclear Boolean setting. + bool autoClear = false; + std::string input; + std::string output; + execute ("task", {"_get", "rc.tasksh.autoclear"}, input, output); + output = lowerCase (output); + autoClear = (output == "true\n" || + output == "1\n" || + output == "y\n" || + output == "yes\n" || + output == "on\n"); + + if (isatty (fileno (stdin))) + welcome (); + + while ((status = commandLoop (autoClear)) == 0) ; } Только в tasksh-1.0.0/src: Path.cpp Только в tasksh-1.0.0/src: Path.h diff -ur tasksh-1.0.0/src/prompt.cpp tasksh-1.2.0/src/prompt.cpp --- tasksh-1.0.0/src/prompt.cpp 2023-06-06 16:42:20.000000000 +0300 +++ tasksh-1.2.0/src/prompt.cpp 2017-05-10 00:46:36.000000000 +0300 @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // -// Copyright 2006 - 2014, Paul Beckingham, Federico Hernandez. +// Copyright 2006 - 2017, Paul Beckingham, Federico Hernandez. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -25,17 +25,79 @@ //////////////////////////////////////////////////////////////////////////////// #include +#include #include +#include + +static std::vector contextColors = { + "bold white on red", + "bold white on blue", + "bold white on green", + "bold white on magenta", + "black on cyan", + "black on yellow", + "black on white", +}; + +static std::vector contexts; + +std::string composeContexts (bool pretty = false); + +//////////////////////////////////////////////////////////////////////////////// +int promptClear () +{ + contexts.clear (); + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// +int promptRemove () +{ + if (contexts.size ()) + contexts.pop_back (); + + return 0; +} //////////////////////////////////////////////////////////////////////////////// -std::string composePrompt () +int promptAdd (const std::string& context) +{ + contexts.push_back (context); + return 0; +} + +//////////////////////////////////////////////////////////////////////////////// +std::string composeContexts (bool pretty /* = false */) +{ + std::string combined; + for (unsigned int i = 0; i < contexts.size (); i++) + if (pretty) + combined += (combined != "" ? " " : "") + + std::string ("\001") + + Color::colorize ("\002 " + contexts[i] + " \001", contextColors[i % contextColors.size ()]) + + "\002"; + else + combined += (combined != "" ? " " : "") + contexts[i]; + + if (combined != "") + combined += ' '; + + return combined; +} + +//////////////////////////////////////////////////////////////////////////////// +std::string promptCompose () { // TODO The prompt may be composed of different elements: // TODO - The configurable text // TODO - The accumulated context, as colored tokens. // TODO - sync status // TODO - time - return "task> "; + auto decoration = composeContexts (true); + if (decoration.length ()) + return "task " + decoration + "> "; + + return "tasksh> "; } //////////////////////////////////////////////////////////////////////////////// Только в tasksh-1.2.0/src: review.cpp Только в tasksh-1.2.0/src: shell.cpp Только в tasksh-1.0.0/src: text.cpp Только в tasksh-1.0.0/src: text.h Только в tasksh-1.0.0/: test