diff --git a/.gitignore b/.gitignore index 60c9df39e..be485ca18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,10 @@ cmake.h -auto.h commit.h Makefile src/task src/libtask.a src/commands/libcommands.a src/columns/libcolumns.a -src/shell/libtasksh.a -src/shell/tasksh *~ .*.swp package-config/osx/binary/task diff --git a/CMakeLists.txt b/CMakeLists.txt index af3073697..cebd0dd11 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,7 +149,6 @@ configure_file ( add_subdirectory (src) add_subdirectory (src/commands) add_subdirectory (src/columns) -add_subdirectory (src/shell) add_subdirectory (doc) add_subdirectory (i18n) add_subdirectory (scripts) @@ -173,6 +172,5 @@ set (CPACK_SOURCE_IGNORE_FILES "CMakeCache" "CMakeFiles" "CPackConfig" "CPackSo "_CPack_Packages" "cmake_install" "install_manifest" "Makefile$" "test" "package-config" "misc/*" "src/task$" "src/libtask.a" "src/columns/libcolumns.a" "src/commands/libcommands.a" - "src/shell/tasksh$" "src/shell/libtasksh.a" "auto.h$" "/\\.gitignore" "/\\.git/" "swp$") include (CPack) diff --git a/NEWS b/NEWS index f8c2828bd..45ae4eb49 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,9 @@ Removed features in 2.4.0 - Removed the unused 'patterns' confguration variable. - Removed the obsolete 'task-faq.5' man page. - Removed the obsolete 'task-tutorial.5' man page. + - Removed the obsolete 'tasksh.1' man page. + - Removed the 'tasksh' program from the Taskwarrior distribution. It is now + a separate project. Known Issues diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 8619b417f..a0072349d 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 2.8) message ("-- Configuring man pages") -set (man_FILES task-color.5 task-sync.5 taskrc.5 task.1 tasksh.1) +set (man_FILES task-color.5 task-sync.5 taskrc.5 task.1) foreach (man_FILE ${man_FILES}) configure_file ( man/${man_FILE}.in diff --git a/doc/man/.gitignore b/doc/man/.gitignore index f68a5505e..811e2c712 100644 --- a/doc/man/.gitignore +++ b/doc/man/.gitignore @@ -2,4 +2,3 @@ task-color.5 task-sync.5 task.1 taskrc.5 -tasksh.1 diff --git a/doc/man/task-color.5.in b/doc/man/task-color.5.in index 14ff52841..d6c49d7f3 100644 --- a/doc/man/task-color.5.in +++ b/doc/man/task-color.5.in @@ -311,7 +311,6 @@ http://www.opensource.org/licenses/mit-license.php for more information. .SH SEE ALSO .BR task(1), -.BR tasksh(1), .BR taskrc(5), .BR task-sync(5) diff --git a/doc/man/task-sync.5.in b/doc/man/task-sync.5.in index b0f19fa71..382c9d267 100644 --- a/doc/man/task-sync.5.in +++ b/doc/man/task-sync.5.in @@ -149,7 +149,6 @@ http://www.opensource.org/licenses/mit-license.php for more information. .SH SEE ALSO .BR task(1), -.BR tasksh(1), .BR taskrc(5), .BR task-color(5), diff --git a/doc/man/task.1.in b/doc/man/task.1.in index bbf203919..f7f841181 100644 --- a/doc/man/task.1.in +++ b/doc/man/task.1.in @@ -1094,7 +1094,6 @@ Taskwarrior is distributed under the MIT license. See http://www.opensource.org/licenses/mit-license.php for more information. .SH SEE ALSO -.BR tasksh(1), .BR taskrc(5), .BR task-color(5), .BR task-sync(5) diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index b9719b536..80c44d350 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -1383,7 +1383,6 @@ http://www.opensource.org/licenses/mit-license.php for more information. .SH SEE ALSO .BR task(1), -.BR tasksh(1), .BR task-color(5), .BR task-sync(5) diff --git a/doc/man/tasksh.1.in b/doc/man/tasksh.1.in deleted file mode 100644 index eff7d76d9..000000000 --- a/doc/man/tasksh.1.in +++ /dev/null @@ -1,183 +0,0 @@ -.TH tasksh 1 2014-01-15 "${PACKAGE_STRING}" "User Manuals" - -.SH NAME -tasksh \- Interactive taskwarrior shell - -.SH SYNOPSIS -.B tasksh [] -.br -.B tasksh --version -.br -.B tasksh --help - -.SH DESCRIPTION -The tasksh program can be used to create a more immersive task 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". - -.br -Moreover, task commands can be written in a file which can be passed or -redirected to tasksh for batch execution. - -.RS -$ tasksh -.br -.B task 2.3.0 -shell -.br - -.br -Enter any task command (such as 'list'), or hit 'Enter'. -.br -There is no need to include the 'task' command itself. -.br -Enter 'quit' to end the session. -.br - -.br -task> projects -.br - -.br -Project Tasks Pri:None Pri:L Pri:M Pri:H -.br -------- ----- -------- ----- ----- ----- -.br - 7 7 0 0 0 -.br -home 2 2 0 0 0 -.br -party 6 3 0 0 3 -.br - -.br -3 projects (15 tasks) -.br -task> tags -.br - -.br -Tag Count -.br -mall 2 -.br - -.br -1 tag (15 tasks) -.br -task> list -.br - -.br -ID Project Pri Due Active Age Description -.br ---------------------------------------------------------------------- -.br - 2 party H 10/17/2010 2 hrs Select and book a venue -.br - 5 party H 10/22/2010 2 hrs Design invitations -.br - 9 home 10/31/2010 1 hr Pay rent -.br - 3 party 2 hrs Mail invitations -.br - 4 party 2 hrs Select a caterer -.br - 6 party 2 hrs Print invitations -.br - -.br - 8 tasks -.br - task> quit -.br - $ -.br - $ cat task.commands -.br - add foo -.br - add bar -.br - $ tasksh task.commands -.br - task 2.3.0 shell -.br - -.br - Enter any task command (such as 'list'), or hit 'Enter'. -.br - There is no need to include the 'task' command itself. -.br - Enter 'quit' to end the session. -.br - -.br - task> add foo -.br - Created task 8. -.br - task> add bar -.br - Created task 9. -.br - $ -.br - $ cat task.commands | tasksh -.br - task 2.3.0 shell -.br - -.br - Enter any task command (such as 'list'), or hit 'Enter'. -.br - There is no need to include the 'task' command itself. -.br - Enter 'quit' to end the session. -.br - -.br - task> add foo -.br - Created task 8. -.br - task> add bar -.br - Created task 9. -.br - -.RE - -.SH "CREDITS & COPYRIGHTS" -Copyright (C) 2006 \- 2014 P. Beckingham, F. Hernandez. - -This man page was originally written by Federico Hernandez. - -Taskwarrior is distributed under the MIT license. See -http://www.opensource.org/licenses/mit-license.php for more information. - -.SH SEE ALSO -.BR task(1), -.BR taskrc(5), -.BR task-color(5), -.BR task-sync(5) - -For more information regarding taskwarrior, see the following: - -.TP -The official site at - - -.TP -The official code repository at - - -.TP -You can contact the project by emailing - - -.SH REPORTING BUGS -.TP -Bugs in taskwarrior may be reported to the issue-tracker at - - diff --git a/src/eng-USA.h b/src/eng-USA.h index 3723e2ad2..91039e750 100644 --- a/src/eng-USA.h +++ b/src/eng-USA.h @@ -938,14 +938,5 @@ #define STRING_UTIL_KIBIBYTES "KiB" #define STRING_UTIL_BYTES "B" -// shell -#define STRING_SHELL_USAGE \ - "Usage: tasksh [] Execute task commands inside if given,\n" \ - " or otherwise, start interactive task shell.\n" \ - " tasksh --version Print task version.\n" \ - " tasksh --help Print this help.\n" - -#define STRING_SHELL_NO_FILE "Input file does not exist.\n" - #endif diff --git a/src/esp-ESP.h b/src/esp-ESP.h index bfabe8086..54ec476f5 100644 --- a/src/esp-ESP.h +++ b/src/esp-ESP.h @@ -968,14 +968,5 @@ #define STRING_UTIL_KIBIBYTES "KiB" // |esp-ESP|==|eng-USA| #define STRING_UTIL_BYTES "B" // |esp-ESP|==|eng-USA| -// shell -#define STRING_SHELL_USAGE \ - "Uso: tasksh [] Ejecuta los comandos task contenidos en , si se indica;\n" \ - " si no, lanza un entorno interactivo de comandos task.\n" \ - " tasksh --version Muestra la versión de task.\n" \ - " tasksh --help Muestra esta ayuda.\n" - -#define STRING_SHELL_NO_FILE "El fichero de entrada no existe.\n" - #endif diff --git a/src/fra-FRA.h b/src/fra-FRA.h index b16f44773..f3c51d6b8 100644 --- a/src/fra-FRA.h +++ b/src/fra-FRA.h @@ -937,14 +937,5 @@ #define STRING_UTIL_KIBIBYTES "KiB" #define STRING_UTIL_BYTES "B" -// shell -#define STRING_SHELL_USAGE \ - "Usage: tasksh [] Execute task commands inside if given,\n" \ - " or otherwise, start interactive task shell.\n" \ - " tasksh --version Print task version.\n" \ - " tasksh --help Print this help.\n" - -#define STRING_SHELL_NO_FILE "Input file does not exist.\n" - #endif diff --git a/src/ita-ITA.h b/src/ita-ITA.h index 007a3598c..3110f9c8c 100644 --- a/src/ita-ITA.h +++ b/src/ita-ITA.h @@ -938,14 +938,5 @@ #define STRING_UTIL_KIBIBYTES "Kb" #define STRING_UTIL_BYTES "B" -// shell -#define STRING_SHELL_USAGE \ - "Uso: tasksh [] Esegue i comandi all'interno di se fornito,\n" \ - " oppure avvia la shell interattiva.\n" \ - " tasksh --version Stampa la versione di task.\n" \ - " tasksh --help Stampa questo aiuto.\n" - -#define STRING_SHELL_NO_FILE "Il file di input non esiste.\n" - #endif diff --git a/src/por-PRT.h b/src/por-PRT.h index c4f1bc90d..634984bfa 100644 --- a/src/por-PRT.h +++ b/src/por-PRT.h @@ -938,14 +938,5 @@ #define STRING_UTIL_KIBIBYTES "KiB" // |por-PRT|==|eng-USA| #define STRING_UTIL_BYTES "B" // |por-PRT|==|eng-USA| -// shell -#define STRING_SHELL_USAGE \ - "Uso: tasksh [] Executa os comandos 'task' contidos no \n" \ - " se fornecido ou alternativamente inicia a shell interativa.\n" \ - " tasksh --version Mostra a versão do taskwarrior.\n" \ - " tasksh --help Mostra esta ajuda.\n" - -#define STRING_SHELL_NO_FILE "O ficheiro de input não existe.\n" - #endif diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt deleted file mode 100644 index 654b08325..000000000 --- a/src/shell/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required (VERSION 2.8) -include_directories (${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_SOURCE_DIR}/src/commands - ${CMAKE_SOURCE_DIR}/src/columns - ${CMAKE_SOURCE_DIR}/src/shell - ${TASK_INCLUDE_DIRS}) - -set (tasksh_SRCS Readline.cpp Readline.h) - -add_library (tasksh STATIC ${tasksh_SRCS}) -add_executable (tasksh_executable main.cpp) - -# Yes, 'task' is included twice, otherwise linking fails on CentOS. -target_link_libraries (tasksh_executable task commands columns tasksh task ${TASK_LIBRARIES}) - -set_property (TARGET tasksh_executable PROPERTY OUTPUT_NAME "tasksh") - -install (TARGETS tasksh_executable DESTINATION ${TASK_BINDIR}) diff --git a/src/shell/Readline.cpp b/src/shell/Readline.cpp deleted file mode 100644 index 545898da4..000000000 --- a/src/shell/Readline.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2006 - 2014, 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 -// 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. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include - -#ifdef HAVE_READLINE -#include -#include -#endif - -//////////////////////////////////////////////////////////////////////////////// -std::string Readline::gets (const std::string& prompt) -{ -#ifdef HAVE_READLINE - // Get a line from the user. - char *line_read = readline (prompt.c_str ()); - if (!line_read) // Exit when CTRL-D is pressed - { - std::cout << "exit\n"; - return "exit"; - } -#else - std::string line_read; - std::cout << prompt; - std::getline (std::cin, line_read); -#endif - -#ifdef HAVE_READLINE - // If the line has any text in it, save it on the history. - if (*line_read) - add_history (line_read); -#endif - - std::string ret(line_read); - -#ifdef HAVE_READLINE - free (line_read); -#endif - - return ret; -} - -//////////////////////////////////////////////////////////////////////////////// -bool Readline::interactiveMode (const std::istream& in) -{ - return (&in == &std::cin && isatty (0) == 1); -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/shell/Readline.h b/src/shell/Readline.h deleted file mode 100644 index 7c6ec0746..000000000 --- a/src/shell/Readline.h +++ /dev/null @@ -1,52 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2006 - 2014, 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 -// 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. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_READLINE -#define INCLUDED_READLINE - -#include -#include -#ifdef HAVE_WORDEXP -#include -#endif - -// Static class that offers a C++ API to readline C functions. -class Readline -{ -public: - static std::string gets (const std::string& prompt); - static bool interactiveMode (const std::istream& in); - -private: - // No construction or destruction. - Readline (); // Don't implement. - ~Readline (); // Don't implement. - Readline (const Readline&); // Don't implement. - Readline& operator= (const Readline&); // Don't implement. -}; - -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/shell/main.cpp b/src/shell/main.cpp deleted file mode 100644 index 4018ce8db..000000000 --- a/src/shell/main.cpp +++ /dev/null @@ -1,245 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2006 - 2014, 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 -// 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. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -Context context; - -#define MAX_ARGUMENTS 256 - -//////////////////////////////////////////////////////////////////////////////// -int main (int argc, const char** argv) -{ - bool read_from_file = false; - - if (argc > 2) - { - std::cout << STRING_SHELL_USAGE << "\n"; - return -1; - } - else if (argc == 2) - { - if (!strcmp (argv[1], "--version")) - { - std::cout << VERSION << "\n"; - return 0; - } - else if (!strcmp (argv[1], "--help")) - { - std::cout << STRING_SHELL_USAGE << "\n"; - return 0; - } - else - { - // The user has given tasksh a task commands file to execute - File input_file = File (argv[1]); - if (!input_file.exists ()) - { - std::cout << STRING_SHELL_NO_FILE; - std::cout << STRING_SHELL_USAGE << "\n"; - return -1; - } - - read_from_file = true; - } - } - - // If a file is given, read from it - std::ifstream fin; - if (read_from_file) - { - fin.open (argv[1]); - } - - // Commands may be redirected too - std::istream &in = read_from_file ? fin : std::cin; - - if (Readline::interactiveMode (in)) - { - // Begining initilaization - if (context.initialize (0, NULL)) - { - return -1; - } - - // Display some kind of welcome message. - Color bold (Color::nocolor, Color::nocolor, false, true, false); - - std::cout << (context.color () ? bold.colorize (PACKAGE_STRING) - : PACKAGE_STRING) - << " shell\n\n" - << STRING_CMD_SHELL_HELP1 << '\n' - << STRING_CMD_SHELL_HELP2 << '\n' - << STRING_CMD_SHELL_HELP3 << "\n\n"; - } - - // Make a copy because context.clear will delete them. - std::string permanent_overrides; - std::vector ::iterator i; - for (i = context.parser.tree ()->_branches.begin (); i != context.parser.tree ()->_branches.end (); ++i) - { - if ((*i)->hasTag ("RC") || - (*i)->hasTag ("CONFIG")) - { - if (i != context.parser.tree ()->_branches.begin ()) - permanent_overrides += " "; - - permanent_overrides += (*i)->attribute ("raw"); - } - } - - std::string input; - - std::vector quit_commands; - quit_commands.push_back ("quit"); - quit_commands.push_back ("exit"); - quit_commands.push_back ("bye"); - - // The event loop. - while (in) - { - std::string prompt (context.config.get ("shell.prompt") + " "); - context.clear (); - - if (Readline::interactiveMode (in)) - { - input = Readline::gets (prompt); - - // if a string has nothing but whitespaces, ignore it - if (input.find_first_not_of (" \t") == std::string::npos) - continue; - } - else - { - std::getline (in, input); - - // if a string has nothing but whitespaces, ignore it - if (input.find_first_not_of (" \t") == std::string::npos) - continue; - - std::cout << prompt << input << '\n'; - } - - try - { -#ifdef HAVE_WORDEXP - std::string command = "task " + trim (input + permanent_overrides); - - // Escape special chars. - size_t i = 0; - while ((i = command.find_first_of ("$*?!|&;<>(){}~#@\\", i)) != std::string::npos) - { - command.insert(i, 1, '\\'); - i += 2; - } - - // Perform expansion. - wordexp_t p; - wordexp (command.c_str (), &p, 0); - char** w = p.we_wordv; - - for (int i = 0; i < p.we_wordc; ++i) - { - if (std::find (quit_commands.begin (), quit_commands.end (), - lowerCase (w[i])) != quit_commands.end ()) - { - context.clearMessages (); - return 0; - } - } - - // External calls. - if (strcmp (w[1], "!") == 0 && p.we_wordc > 2) - { - std::string combined = ""; - for (int i = 2; i < p.we_wordc - 1 ; ++i) - { - combined += std::string (w[i]) + " "; - } - combined += w[p.we_wordc - 1]; // last goes without a blank - system (combined.c_str ()); // not checked - continue; - } - - int status = context.initialize (p.we_wordc, (const char**)p.we_wordv); - wordfree(&p); -#else - std::string command = "task " + trim (input + permanent_overrides); - int arg_count = 0; - char* arg_vector[MAX_ARGUMENTS]; - - char* arg = strtok ((char*)command.c_str (), " "); - while (arg && arg_count < MAX_ARGUMENTS) - { - arg_vector[arg_count++] = arg; - arg = strtok (0, " "); - } - - for (int i = 1; i < arg_count; ++i) - { - if (std::find (quit_commands.begin (), quit_commands.end (), - lowerCase (arg_vector[i])) != quit_commands.end ()) - { - context.clearMessages (); - return 0; - } - } - - int status = context.initialize (arg_count, (const char**) arg_vector); -#endif - - if (status == 0) - context.run (); - } - - catch (const std::string& error) - { - std::cerr << error << '\n'; - return -1; - } - - catch (...) - { - std::cerr << STRING_UNKNOWN_ERROR << '\n'; - return -2; - } - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// diff --git a/test/shell.t b/test/shell.t deleted file mode 100755 index 21eb92771..000000000 --- a/test/shell.t +++ /dev/null @@ -1,61 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## -## Copyright 2006 - 2014, 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 -## 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. -## -## http://www.opensource.org/licenses/mit-license.php -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 3; - -# Ensure environment has no influence. -delete $ENV{'TASKDATA'}; -delete $ENV{'TASKRC'}; - -# Create the rc file. -if (open my $fh, '>', 'shell.rc') -{ - print $fh "data.location=.\n", - "shell.prompt=testprompt>\n", - "defaultwidth=0\n", - "default.command=ls\n"; - close $fh; -} - -# Test the prompt. -my $output = qx{printf "rc:shell.rc add foo\nquit" | ../src/shell/tasksh 2>&1}; -like ($output, qr/testprompt>/, 'custom prompt is being used'); - -# Test a simple add, then info. -qx{echo "rc:shell.rc add foo" | ../src/shell/tasksh 2>&1}; -$output = qx{echo "rc:shell.rc 1 info" | ../src/shell/tasksh 2>&1}; -like ($output, qr/Description\s+foo/, 'add/info working'); - -unlink 'shell.rc'; -ok (!-r 'shell.rc', 'Removed shell.rc'); - -# Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data shell.rc); -exit 0; -