diff --git a/Makefile.in b/Makefile.in index a39b4bb56..415233a58 100644 --- a/Makefile.in +++ b/Makefile.in @@ -89,11 +89,11 @@ FISH_OBJS := function.o builtin.o complete.o env.o exec.o expand.o \ env_universal.o env_universal_common.o input_common.o event.o \ signal.o io.o parse_util.o common.o screen.o path.o autoload.o \ parser_keywords.o iothread.o color.o postfork.o \ - builtin_test.o parse_tree.o parse_productions.o parse_execution.cpp \ - pager.cpp utf8.o + builtin_test.o parse_tree.o parse_productions.o parse_execution.o \ + pager.o utf8.o fish_version.o FISH_INDENT_OBJS := fish_indent.o print_help.o common.o \ -parser_keywords.o wutil.o tokenizer.o +parser_keywords.o wutil.o tokenizer.o fish_version.o # # Additional files used by builtin.o @@ -116,7 +116,7 @@ FISH_TESTS_OBJS := $(FISH_OBJS) fish_tests.o # FISHD_OBJS := fishd.o env_universal_common.o wutil.o print_help.o \ - common.o utf8.o + common.o utf8.o fish_version.o # @@ -125,7 +125,7 @@ FISHD_OBJS := fishd.o env_universal_common.o wutil.o print_help.o \ MIME_OBJS := mimedb.o print_help.o xdgmimealias.o xdgmime.o \ xdgmimeglob.o xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o \ - common.o + common.o fish_version.o # @@ -228,7 +228,7 @@ FISH-BUILD-VERSION-FILE: FORCE -include FISH-BUILD-VERSION-FILE CPPFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\" .PHONY: FORCE -env.o fish.o fish_indent.o fishd.o mimedb.o: FISH-BUILD-VERSION-FILE +fish_version.o: FISH-BUILD-VERSION-FILE # @@ -776,14 +776,6 @@ clean: autoload.o: config.h autoload.h common.h util.h lru.h wutil.h signal.h env.h autoload.o: exec.h proc.h io.h parse_tree.h tokenizer.h parse_constants.h -builtin.o: config.h signal.h fallback.h util.h wutil.h common.h builtin.h -builtin.o: io.h function.h event.h complete.h proc.h parse_tree.h tokenizer.h -builtin.o: parse_constants.h parser.h reader.h highlight.h env.h color.h -builtin.o: wgetopt.h sanity.h wildcard.h expand.h input_common.h input.h -builtin.o: intern.h exec.h parse_util.h autoload.h lru.h parser_keywords.h -builtin.o: path.h history.h builtin_set.cpp builtin_commandline.cpp -builtin.o: builtin_complete.cpp builtin_ulimit.cpp builtin_jobs.cpp -builtin.o: builtin_set_color.cpp output.h screen.h builtin_printf.cpp builtin_commandline.o: config.h signal.h fallback.h util.h wutil.h common.h builtin_commandline.o: builtin.h io.h wgetopt.h reader.h complete.h builtin_commandline.o: highlight.h env.h color.h proc.h parse_tree.h @@ -794,37 +786,45 @@ builtin_complete.o: config.h signal.h fallback.h util.h wutil.h common.h builtin_complete.o: builtin.h io.h complete.h wgetopt.h parser.h proc.h builtin_complete.o: parse_tree.h tokenizer.h parse_constants.h event.h builtin_complete.o: function.h reader.h highlight.h env.h color.h +builtin.o: config.h signal.h fallback.h util.h wutil.h common.h builtin.h +builtin.o: io.h function.h event.h complete.h proc.h parse_tree.h tokenizer.h +builtin.o: parse_constants.h parser.h reader.h highlight.h env.h color.h +builtin.o: wgetopt.h sanity.h wildcard.h expand.h input_common.h input.h +builtin.o: intern.h exec.h parse_util.h autoload.h lru.h parser_keywords.h +builtin.o: path.h history.h builtin_set.cpp builtin_commandline.cpp +builtin.o: builtin_complete.cpp builtin_ulimit.cpp builtin_jobs.cpp +builtin.o: builtin_set_color.cpp output.h screen.h builtin_printf.cpp builtin_jobs.o: config.h fallback.h signal.h util.h wutil.h common.h builtin_jobs.o: builtin.h io.h proc.h parse_tree.h tokenizer.h builtin_jobs.o: parse_constants.h parser.h event.h function.h wgetopt.h builtin_printf.o: common.h util.h -builtin_set.o: config.h signal.h fallback.h util.h wutil.h common.h builtin.h -builtin_set.o: io.h env.h expand.h wgetopt.h proc.h parse_tree.h tokenizer.h -builtin_set.o: parse_constants.h parser.h event.h function.h builtin_set_color.o: config.h builtin.h util.h io.h common.h color.h output.h builtin_set_color.o: screen.h highlight.h env.h +builtin_set.o: config.h signal.h fallback.h util.h wutil.h common.h builtin.h +builtin_set.o: io.h env.h expand.h parse_constants.h wgetopt.h proc.h +builtin_set.o: parse_tree.h tokenizer.h parser.h event.h function.h builtin_test.o: config.h common.h util.h builtin.h io.h wutil.h proc.h builtin_test.o: signal.h parse_tree.h tokenizer.h parse_constants.h builtin_ulimit.o: config.h fallback.h signal.h util.h builtin.h io.h common.h builtin_ulimit.o: wgetopt.h color.o: color.h config.h common.h util.h fallback.h signal.h common.o: config.h fallback.h signal.h util.h wutil.h common.h expand.h -common.o: proc.h io.h parse_tree.h tokenizer.h parse_constants.h wildcard.h +common.o: parse_constants.h proc.h io.h parse_tree.h tokenizer.h wildcard.h common.o: complete.h parser.h event.h function.h util.cpp fallback.cpp complete.o: config.h signal.h fallback.h util.h tokenizer.h common.h -complete.o: wildcard.h expand.h complete.h proc.h io.h parse_tree.h -complete.o: parse_constants.h parser.h event.h function.h builtin.h env.h -complete.o: exec.h reader.h highlight.h color.h history.h wutil.h intern.h +complete.o: wildcard.h expand.h parse_constants.h complete.h proc.h io.h +complete.o: parse_tree.h parser.h event.h function.h builtin.h env.h exec.h +complete.o: reader.h highlight.h color.h history.h wutil.h intern.h complete.o: parse_util.h autoload.h lru.h parser_keywords.h path.h iothread.h env.o: config.h signal.h fallback.h util.h wutil.h common.h proc.h io.h env.o: parse_tree.h tokenizer.h parse_constants.h env.h sanity.h expand.h env.o: history.h reader.h complete.h highlight.h color.h parser.h event.h env.o: function.h env_universal.h env_universal_common.h input.h -env.o: input_common.h path.h -env_universal.o: config.h signal.h fallback.h util.h common.h wutil.h -env_universal.o: env_universal_common.h env_universal.h +env.o: input_common.h path.h fish_version.h env_universal_common.o: config.h signal.h fallback.h util.h common.h wutil.h -env_universal_common.o: env_universal_common.h +env_universal_common.o: utf8.h env_universal_common.h env.h +env_universal.o: config.h signal.h fallback.h util.h common.h wutil.h +env_universal.o: env_universal_common.h env.h env_universal.h event.o: config.h signal.h fallback.h util.h wutil.h common.h function.h event.o: event.h input_common.h proc.h io.h parse_tree.h tokenizer.h event.o: parse_constants.h parser.h @@ -841,17 +841,18 @@ fish.o: config.h signal.h fallback.h util.h common.h reader.h io.h complete.h fish.o: highlight.h env.h color.h builtin.h function.h event.h wutil.h fish.o: sanity.h proc.h parse_tree.h tokenizer.h parse_constants.h parser.h fish.o: expand.h intern.h exec.h output.h screen.h history.h path.h input.h -fish.o: input_common.h +fish.o: input_common.h fish_version.h +fishd.o: config.h signal.h fallback.h util.h common.h wutil.h +fishd.o: env_universal_common.h env.h path.h print_help.h fish_version.h fish_indent.o: config.h fallback.h signal.h util.h common.h wutil.h -fish_indent.o: tokenizer.h print_help.h parser_keywords.h +fish_indent.o: tokenizer.h print_help.h parser_keywords.h fish_version.h fish_tests.o: config.h signal.h fallback.h util.h common.h proc.h io.h fish_tests.o: parse_tree.h tokenizer.h parse_constants.h reader.h complete.h fish_tests.o: highlight.h env.h color.h builtin.h function.h event.h fish_tests.o: autoload.h lru.h wutil.h expand.h parser.h output.h screen.h fish_tests.o: exec.h path.h history.h iothread.h postfork.h parse_util.h -fish_tests.o: pager.h -fishd.o: config.h signal.h fallback.h util.h common.h wutil.h -fishd.o: env_universal_common.h path.h env.h print_help.h +fish_tests.o: pager.h input.h input_common.h utf8.h +fish_version.o: fish_version.h function.o: config.h signal.h wutil.h common.h util.h fallback.h function.h function.o: event.h proc.h io.h parse_tree.h tokenizer.h parse_constants.h function.o: parser.h intern.h reader.h complete.h highlight.h env.h color.h @@ -862,15 +863,16 @@ highlight.o: parse_constants.h parser.h event.h function.h parse_util.h highlight.o: autoload.h lru.h parser_keywords.h builtin.h expand.h sanity.h highlight.o: complete.h output.h screen.h wildcard.h path.h history.h history.o: config.h fallback.h signal.h util.h sanity.h tokenizer.h common.h -history.o: reader.h io.h complete.h highlight.h env.h color.h wutil.h -history.o: history.h intern.h path.h autoload.h lru.h iothread.h +history.o: reader.h io.h complete.h highlight.h env.h color.h parse_tree.h +history.o: parse_constants.h wutil.h history.h intern.h path.h autoload.h +history.o: lru.h iothread.h +input_common.o: config.h fallback.h signal.h util.h common.h wutil.h +input_common.o: input_common.h env_universal.h env_universal_common.h env.h +input_common.o: iothread.h input.o: config.h signal.h fallback.h util.h wutil.h common.h reader.h io.h input.o: complete.h highlight.h env.h color.h proc.h parse_tree.h tokenizer.h input.o: parse_constants.h sanity.h input_common.h input.h parser.h event.h input.o: function.h expand.h output.h screen.h intern.h -input_common.o: config.h fallback.h signal.h util.h common.h wutil.h -input_common.o: input_common.h env_universal.h env_universal_common.h -input_common.o: iothread.h intern.o: config.h fallback.h signal.h util.h wutil.h common.h intern.h io.o: config.h fallback.h signal.h util.h wutil.h common.h exec.h proc.h io.h io.o: parse_tree.h tokenizer.h parse_constants.h @@ -880,10 +882,11 @@ kill.o: config.h signal.h fallback.h util.h wutil.h common.h kill.h proc.h kill.o: io.h parse_tree.h tokenizer.h parse_constants.h sanity.h env.h exec.h kill.o: path.h mimedb.o: config.h xdgmime.h fallback.h signal.h util.h print_help.h +mimedb.o: fish_version.h output.o: config.h signal.h fallback.h util.h wutil.h common.h expand.h -output.o: output.h screen.h highlight.h env.h color.h +output.o: parse_constants.h output.h screen.h highlight.h env.h color.h pager.o: config.h pager.h complete.h util.h common.h screen.h highlight.h -pager.o: env.h color.h input_common.h +pager.o: env.h color.h reader.h io.h input_common.h wutil.h parse_execution.o: parse_execution.h config.h util.h parse_tree.h common.h parse_execution.o: tokenizer.h parse_constants.h proc.h signal.h io.h parse_execution.o: parse_util.h autoload.h lru.h complete.h wildcard.h @@ -891,13 +894,6 @@ parse_execution.o: expand.h builtin.h parser.h event.h function.h reader.h parse_execution.o: highlight.h env.h color.h wutil.h exec.h path.h parse_productions.o: parse_productions.h parse_tree.h config.h util.h parse_productions.o: common.h tokenizer.h parse_constants.h -parse_tree.o: parse_productions.h parse_tree.h config.h util.h common.h -parse_tree.o: tokenizer.h parse_constants.h fallback.h signal.h wutil.h -parse_tree.o: proc.h io.h -parse_util.o: config.h fallback.h signal.h util.h wutil.h common.h -parse_util.o: tokenizer.h parse_util.h autoload.h lru.h parse_tree.h -parse_util.o: parse_constants.h expand.h intern.h exec.h proc.h io.h env.h -parse_util.o: wildcard.h complete.h parser.h event.h function.h parser.o: config.h signal.h fallback.h util.h common.h wutil.h proc.h io.h parser.o: parse_tree.h tokenizer.h parse_constants.h parser.h event.h parser.o: function.h parser_keywords.h exec.h wildcard.h expand.h complete.h @@ -906,8 +902,15 @@ parser.o: env_universal.h env_universal_common.h intern.h parse_util.h parser.o: autoload.h lru.h path.h parse_execution.h parser_keywords.o: config.h fallback.h signal.h common.h util.h parser_keywords.o: parser_keywords.h +parse_tree.o: parse_productions.h parse_tree.h config.h util.h common.h +parse_tree.o: tokenizer.h parse_constants.h fallback.h signal.h wutil.h +parse_tree.o: proc.h io.h +parse_util.o: config.h fallback.h signal.h util.h wutil.h common.h +parse_util.o: tokenizer.h parse_util.h autoload.h lru.h parse_tree.h +parse_util.o: parse_constants.h expand.h intern.h exec.h proc.h io.h env.h +parse_util.o: wildcard.h complete.h parser.h event.h function.h builtin.h path.o: config.h fallback.h signal.h util.h common.h env.h wutil.h path.h -path.o: expand.h +path.o: expand.h parse_constants.h postfork.o: signal.h postfork.h config.h common.h util.h proc.h io.h postfork.o: parse_tree.h tokenizer.h parse_constants.h wutil.h iothread.h postfork.o: exec.h @@ -926,20 +929,21 @@ sanity.o: config.h signal.h fallback.h util.h common.h sanity.h proc.h io.h sanity.o: parse_tree.h tokenizer.h parse_constants.h history.h wutil.h sanity.o: reader.h complete.h highlight.h env.h color.h kill.h screen.o: config.h fallback.h signal.h common.h util.h wutil.h output.h -screen.o: screen.h highlight.h env.h color.h pager.h complete.h +screen.o: screen.h highlight.h env.h color.h pager.h complete.h reader.h io.h signal.o: config.h signal.h common.h util.h fallback.h wutil.h event.h signal.o: reader.h io.h complete.h highlight.h env.h color.h proc.h signal.o: parse_tree.h tokenizer.h parse_constants.h tokenizer.o: config.h fallback.h signal.h util.h wutil.h common.h tokenizer.h +utf8.o: utf8.h util.o: config.h fallback.h signal.h util.h common.h wutil.h wgetopt.o: config.h wgetopt.h wutil.h common.h util.h fallback.h signal.h wildcard.o: config.h fallback.h signal.h util.h wutil.h common.h complete.h -wildcard.o: wildcard.h expand.h reader.h io.h highlight.h env.h color.h -wildcard.o: exec.h proc.h parse_tree.h tokenizer.h parse_constants.h +wildcard.o: wildcard.h expand.h parse_constants.h reader.h io.h highlight.h +wildcard.o: env.h color.h exec.h proc.h parse_tree.h tokenizer.h wutil.o: config.h fallback.h signal.h util.h common.h wutil.h +xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h xdgmime.o: xdgmimeparent.h -xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h xdgmimeglob.o: xdgmimeglob.h xdgmime.h xdgmimeint.h xdgmimeint.o: xdgmimeint.h xdgmime.h xdgmimemagic.o: xdgmimemagic.h xdgmime.h xdgmimeint.h diff --git a/builtin.cpp b/builtin.cpp index 9f63e5155..741dbd4ad 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -425,27 +425,17 @@ static void builtin_bind_list(const wchar_t *bind_mode) } wcstring tname; - if (input_terminfo_get_name(seq, tname)) + + const wcstring eseq = input_terminfo_get_name(seq, tname) ? tname : escape_string(seq, 1); + append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", eseq.c_str(), mode.c_str(), sets_mode.c_str()); + for (size_t i = 0; i < ecmds.size(); i++) { - append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", tname.c_str(), mode.c_str(), sets_mode.c_str()); - for (size_t i = 0; i < ecmds.size(); i++) - { - wcstring ecmd = ecmds.at(i); - append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1)); - } - append_format(stdout_buffer, L"\n"); - } - else - { - const wcstring eseq = escape_string(seq, 1); - append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", eseq.c_str(), mode.c_str(), sets_mode.c_str()); - for (size_t i = 0; i < ecmds.size(); i++) - { - wcstring ecmd = ecmds.at(i); - append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1)); - } - append_format(stdout_buffer, L"\n"); + wcstring ecmd = ecmds.at(i); + wchar_t *escaped = escape(ecmd.c_str(), 1); + append_format(stdout_buffer, L" %ls", escaped); + free(escaped); } + append_format(stdout_buffer, L"\n"); } } diff --git a/common.cpp b/common.cpp index 4bb151042..ac0181d36 100644 --- a/common.cpp +++ b/common.cpp @@ -410,7 +410,7 @@ wcstring format_string(const wchar_t *format, ...) return result; } -wcstring vformat_string(const wchar_t *format, va_list va_orig) +void append_formatv(wcstring &target, const wchar_t *format, va_list va_orig) { const int saved_err = errno; /* @@ -461,22 +461,21 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig) va_end(va); } - wcstring result = wcstring(buff); + target.append(buff); if (buff != static_buff) + { free(buff); + } errno = saved_err; - return result; } -void append_formatv(wcstring &str, const wchar_t *format, va_list ap) +wcstring vformat_string(const wchar_t *format, va_list va_orig) { - /* Preserve errno across this call since it likes to stomp on it */ - int err = errno; - str.append(vformat_string(format, ap)); - errno = err; - + wcstring result; + append_formatv(result, format, va_orig); + return result; } void append_format(wcstring &str, const wchar_t *format, ...) diff --git a/complete.cpp b/complete.cpp index 73d3182e9..cf915e7d4 100644 --- a/complete.cpp +++ b/complete.cpp @@ -1976,28 +1976,42 @@ void complete(const wcstring &cmd_with_subcmds, std::vector &comps } } } - - bool do_file = false; - - wcstring current_command_unescape, previous_argument_unescape, current_argument_unescape; - if (unescape_string(current_command, ¤t_command_unescape, UNESCAPE_DEFAULT) && - unescape_string(previous_argument, &previous_argument_unescape, UNESCAPE_DEFAULT) && - unescape_string(current_argument, ¤t_argument_unescape, UNESCAPE_INCOMPLETE)) + + /* If we are not in an argument, we may be in a redirection */ + bool in_redirection = false; + if (matching_arg_index == (size_t)(-1)) { - do_file = completer.complete_param(current_command_unescape, - previous_argument_unescape, - current_argument_unescape, - !had_ddash); + const parse_node_t *redirection = tree.find_node_matching_source_location(symbol_redirection, adjusted_pos, plain_statement); + in_redirection = (redirection != NULL); } - - /* If we have found no command specific completions at all, fall back to using file completions. */ - if (completer.empty()) - do_file = true; - - /* And if we're autosuggesting, and the token is empty, don't do file suggestions */ - if ((flags & COMPLETION_REQUEST_AUTOSUGGESTION) && current_argument_unescape.empty()) + + bool do_file = false; + if (in_redirection) { - do_file = false; + do_file = true; + } + else + { + wcstring current_command_unescape, previous_argument_unescape, current_argument_unescape; + if (unescape_string(current_command, ¤t_command_unescape, UNESCAPE_DEFAULT) && + unescape_string(previous_argument, &previous_argument_unescape, UNESCAPE_DEFAULT) && + unescape_string(current_argument, ¤t_argument_unescape, UNESCAPE_INCOMPLETE)) + { + do_file = completer.complete_param(current_command_unescape, + previous_argument_unescape, + current_argument_unescape, + !had_ddash); + } + + /* If we have found no command specific completions at all, fall back to using file completions. */ + if (completer.empty()) + do_file = true; + + /* And if we're autosuggesting, and the token is empty, don't do file suggestions */ + if ((flags & COMPLETION_REQUEST_AUTOSUGGESTION) && current_argument_unescape.empty()) + { + do_file = false; + } } /* This function wants the unescaped string */ diff --git a/configure.ac b/configure.ac index b0a4858e8..b6b7626b0 100644 --- a/configure.ac +++ b/configure.ac @@ -379,7 +379,7 @@ fi # Check presense of various header files # -AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h execinfo.h spawn.h sys/sysctl.h]) +AC_CHECK_HEADERS([getopt.h termios.h sys/resource.h term.h ncurses/term.h ncurses.h curses.h stropts.h siginfo.h sys/select.h sys/ioctl.h execinfo.h spawn.h sys/sysctl.h sys/un.h sys/ucred.h ucred.h ]) if test x$local_gettext != xno; then AC_CHECK_HEADERS([libintl.h]) @@ -397,6 +397,11 @@ AC_CHECK_HEADER( [AC_MSG_ERROR([Could not find the header regex.h, needed to build fish])] ) +# +# Detect nanoseconds fields in struct stat +# +AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) +AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) # # On some platforms (Solaris 10) adding -std=c99 in turn requires that @@ -519,8 +524,8 @@ fi AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp fwprintf ) AC_CHECK_FUNCS( futimes wcwidth wcswidth wcstok fputwc fgetwc ) -AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg ) -AC_CHECK_FUNCS( backtrace backtrace_symbols sysconf getifaddrs ) +AC_CHECK_FUNCS( wcstol wcslcat wcslcpy lrand48_r killpg mkostemp ) +AC_CHECK_FUNCS( backtrace backtrace_symbols sysconf getifaddrs getpeerucred getpeereid ) AC_CHECK_FUNCS( inotify_init inotify_init1 ) if test x$local_gettext != xno; then diff --git a/doc_src/eval.txt b/doc_src/eval.txt index f8af8f666..47e4627dc 100644 --- a/doc_src/eval.txt +++ b/doc_src/eval.txt @@ -9,7 +9,7 @@ \subsection eval-example Example The following code will call the ls command. Note that \c fish does not -support the use of environment variables as direct commands; \c eval can +support the use of shell variables as direct commands; \c eval can be used to work around this.
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 51bf4e43d..9e67724ab 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -413,7 +413,7 @@ command line.
 These are the general purpose tab completions that \c fish provides:
 
 - Completion of commands (builtins, functions and regular programs).
-- Completion of environment variable names.
+- Completion of shell variable names.
 - Completion of usernames for tilde expansion.
 - Completion of filenames, even on strings with wildcards such as '*', '**' and '?'.
 - Completion of job ID, job name and process names for process expansion.
@@ -559,7 +559,7 @@ undergoes the process of parameter expansion before it is sent on to
 the command. Parameter expansion is a powerful mechanism that
 allows you to expand the parameter in various ways, including
 performing wildcard matching on files, inserting the value of
-environment variables into the parameter or even using the output of
+a shell variable into the parameter or even using the output of
 another command as a parameter list.
 
 \subsection expand-wildcard Wildcards
@@ -634,10 +634,10 @@ The command mv *.{c,h} src/ moves all files with the suffix
 
 \subsection expand-variable Variable expansion
 
-A dollar sign followed by a string of characters is expanded into the
-value of the environment variable with the same name. For an
-introduction to the concept of environment variables, read the Environment variables section.
+A dollar sign followed by a string of characters is expanded into the 
+value of the shell variable with the same name. For an 
+introduction to the concept of shell variables, read the 
+Shell variables section.
 
 Undefined and empty variables expand to nothing.
 
@@ -699,7 +699,7 @@ instead be expressed as $$foo[1][5].
 
 \subsection expand-index-range Index range expansion
 
-Both command substitution and environment variables support accessing only 
+Both command substitution and shell variable expansion support accessing only 
 specific items by providing a set of indices in square brackets. It's 
 often needed to access a sequence of elements. To do this, use the range
 operator '..' for this. A range 'a..b', where range limits 'a'
@@ -799,10 +799,12 @@ If the current directory contains the files 'foo' and 'bar', the command
 will output 'abar1 abar2 abar3 afoo1 afoo2 afoo3'.
 
 
-\section variables Environment variables
+\section variables Shell variables
 
-Environment variables are named pieces of data, which can be created, deleted
-and their values changed and used by the user.
+Shell variables are named pieces of data, which can be created, deleted
+and their values changed and used by the user.  Variables may optionally be "exported", so
+that a copy of the variable is available to any subprocesses the shell creates. An
+exported variable is referred to as an "environment variable".
 
 To set a variable value, use the  \c set
 command.
diff --git a/doc_src/license.hdr b/doc_src/license.hdr
index 7f14383a7..4403620d5 100644
--- a/doc_src/license.hdr
+++ b/doc_src/license.hdr
@@ -1400,7 +1400,34 @@ POSSIBILITY OF SUCH DAMAGES.
 
 

-*/ +


+ +

License for getpeereid

+ +\c fish contains code imported from the PostgreSQL project under +license, namely the getpeereid fallback function. This code is copyrighted +by: + +Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + +Portions Copyright (c) 1994, The Regents of the University of California + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose, without fee, and without a written agreement +is hereby granted, provided that the above copyright notice and this +paragraph and the following two paragraphs appear in all copies. + +IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING +LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

License for UTF8

@@ -1419,3 +1446,4 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \htmlonly \endhtmlonly +*/ diff --git a/doc_src/math.txt b/doc_src/math.txt index 9904a2cce..8e1fd3b51 100644 --- a/doc_src/math.txt +++ b/doc_src/math.txt @@ -14,7 +14,7 @@ or a pipeline. For a description of the syntax supported by math, see the manual for the bc program. Keep in mind that parameter expansion takes place on any expressions before they are evaluated. This can be very useful in -order to perform calculations involving environment variables or the +order to perform calculations involving shell variables or the output of command substitutions, but it also means that parenthesis have to be escaped. diff --git a/doc_src/read.txt b/doc_src/read.txt index 1e8aef373..bb13f991b 100644 --- a/doc_src/read.txt +++ b/doc_src/read.txt @@ -6,7 +6,7 @@ \subsection read-description Description read reads one line from standard -input and stores the result in one or more environment variables. +input and stores the result in one or more shell variables. The following options are available: @@ -17,17 +17,17 @@ The following options are available: - -p PROMPT_CMD or --prompt=PROMPT_CMD uses the output of the shell command \c PROMPT_CMD as the prompt for the interactive mode. The default prompt command is set_color green; echo read; set_color normal; echo "> ". - -s or --shell enables syntax highlighting, tab completions and command termination suitable for entering shellscript code in the interactive mode. - -u or --unexport prevents the variables from being exported to child processes (default behaviour). -- -U or --universal causes the specified environment variable to be made universal. +- -U or --universal causes the specified shell variable to be made universal. - -x or --export exports the variables to child processes. \c read reads a single line of input from stdin, breaks it into tokens -based on the IFS environment variable, and then assigns one +based on the IFS shell variable, and then assigns one token to each variable specified in VARIABLES. If there are more tokens than variables, the complete remainder is assigned to the last variable. \subsection read-example Example -The following code stores the value 'hello' in the environment variable +The following code stores the value 'hello' in the shell variable $foo. echo hello|read foo diff --git a/doc_src/set.txt b/doc_src/set.txt index e9e67392e..a78d30468 100644 --- a/doc_src/set.txt +++ b/doc_src/set.txt @@ -1,4 +1,4 @@ -\section set set - display and change environment variables. +\section set set - display and change shell variables. \subsection set-synopsis Synopsis
@@ -12,11 +12,11 @@ set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
 
 \subsection set-description Description
 
-set manipulates environment
+set manipulates shell
 variables.
 
 If set is called with no arguments, the names and values of all
-environment variables are printed. If some of the scope or export
+shell variables are printed. If some of the scope or export
 flags have been given, only the variables matching the specified scope
 are printed.
 
@@ -24,15 +24,15 @@ With both variable names and values provided, \c set assigns the variable
 VARIABLE_NAME the values VALUES....
 
 The following options control variable scope:
-- -l or --local forces the specified environment variable to be given a scope that is local to the current block, even if a variable with the given name exists and is non-local
-- -g or --global causes the specified environment variable to be given a global scope. Non-global variables disappear when the block they belong to ends
-- -U or --universal causes the specified environment variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
+- -l or --local forces the specified shell variable to be given a scope that is local to the current block, even if a variable with the given name exists and is non-local
+- -g or --global causes the specified shell variable to be given a global scope. Non-global variables disappear when the block they belong to ends
+- -U or --universal causes the specified shell variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
 - -n or --names List only the names of all defined variables, not their value
-- -u or --unexport causes the specified environment not to be exported to child processes
-- -x or --export causes the specified environment variable to be exported to child processes
+- -x or --export causes the specified shell variable to be exported to child processes (making it an "environment variable")
+- -u or --unexport causes the specified shell variable to NOT be exported to child processes
 
 The following options are available:
-- -e or --erase causes the specified environment variable to be erased
+- -e or --erase causes the specified shell variable to be erased
 - -q or --query test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
 - -L or --long do not abbreviate long values when printing set variables
 
diff --git a/doc_src/source.txt b/doc_src/source.txt
index 786577dc4..8798e9d9f 100644
--- a/doc_src/source.txt
+++ b/doc_src/source.txt
@@ -9,7 +9,7 @@
 shell. This is different from starting a new process to perform the
 commands (i.e. fish < FILENAME) since the commands will be
 evaluated by the current shell, which means that changes in
-environment variables affect the current shell. If additional arguments are
+shell variables will affect the current shell. If additional arguments are
 specified after the file name, they will be inserted into the $argv
 variable.
 
diff --git a/doc_src/tutorial.hdr b/doc_src/tutorial.hdr
index f28541b82..58f925d5e 100644
--- a/doc_src/tutorial.hdr
+++ b/doc_src/tutorial.hdr
@@ -193,7 +193,7 @@ h3 { font-size: 110%; }
                 
  • Tab Completions
  • Variables
  • Exit Status
  • -
  • Environment Variables
  • +
  • Shell Variables
  • Lists
  • Command Substitutions
  • Combiners (And, Or, Not)
  • @@ -258,7 +258,7 @@ fish has excellent help and man pages. Run help to open help in a web b
     > man set
    -set - handle environment variables
    +set - handle shell variables
       Synopsis...
     
    @@ -429,7 +429,7 @@ Unlike other shells, fish stores the exit status of the last command in $sta Zero is considered success, and non-zero is failure. -

    Exports (Environment Variables)

    +

    Exports (Shell Variables)

    Unlike other shells, fish does not have an export command. Instead, a variable is exported via an option to set, either --export or just -x. diff --git a/env.cpp b/env.cpp index 7a0fc85b4..ff62a53f6 100644 --- a/env.cpp +++ b/env.cpp @@ -55,6 +55,7 @@ #include "path.h" #include "complete.h" +#include "fish_version.h" /** Command used to start fishd */ #define FISHD_CMD L"fishd ^ /tmp/fishd.log.%s" @@ -599,7 +600,7 @@ void env_init(const struct config_paths_t *paths /* or NULL */) /* Set up the version variables */ - wcstring version = str2wcstring(FISH_BUILD_VERSION); + wcstring version = str2wcstring(get_fish_version()); env_set(L"version", version.c_str(), ENV_GLOBAL); env_set(L"FISH_VERSION", version.c_str(), ENV_GLOBAL); diff --git a/env_universal.cpp b/env_universal.cpp index 9efb05800..8d64923ee 100644 --- a/env_universal.cpp +++ b/env_universal.cpp @@ -89,6 +89,8 @@ static int try_get_socket_once(void) wdir = path; wuname = user; + uid_t seuid; + gid_t segid; if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { @@ -142,6 +144,13 @@ static int try_get_socket_once(void) return -1; } + if ((getpeereid(s, &seuid, &segid) != 0) || seuid != geteuid()) + { + debug(1, L"Wrong credentials for socket %s at fd %d", name.c_str(), s); + close(s); + return -1; + } + if ((make_fd_nonblocking(s) != 0) || (fcntl(s, F_SETFD, FD_CLOEXEC) != 0)) { wperror(L"fcntl"); diff --git a/fallback.cpp b/fallback.cpp index 405c499f8..e81b87029 100644 --- a/fallback.cpp +++ b/fallback.cpp @@ -15,8 +15,9 @@ #include #include #include +#include #include -#include +#include #include #include #include @@ -1520,3 +1521,80 @@ static int mk_wcswidth(const wchar_t *pwcs, size_t n) } #endif // HAVE_BROKEN_WCWIDTH + +#ifndef HAVE_GETPEEREID + +/*------------------------------------------------------------------------- + * + * getpeereid.c + * get peer userid for UNIX-domain socket connection + * + * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group + * + * + * IDENTIFICATION + * src/port/getpeereid.c + * + *------------------------------------------------------------------------- + */ + +#ifdef HAVE_SYS_UN_H +#include +#endif +#ifdef HAVE_UCRED_H +#include +#endif +#ifdef HAVE_SYS_UCRED_H +#include +#endif + +/* + * BSD-style getpeereid() for platforms that lack it. + */ +int getpeereid(int sock, uid_t *uid, gid_t *gid) +{ +#if defined(SO_PEERCRED) + /* Linux: use getsockopt(SO_PEERCRED) */ + struct ucred peercred; + socklen_t so_len = sizeof(peercred); + + if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) != 0 || + so_len != sizeof(peercred)) + return -1; + *uid = peercred.uid; + *gid = peercred.gid; + return 0; +#elif defined(LOCAL_PEERCRED) + /* Debian with FreeBSD kernel: use getsockopt(LOCAL_PEERCRED) */ + struct xucred peercred; + socklen_t * so_len = sizeof(peercred); + + if (getsockopt(sock, 0, LOCAL_PEERCRED, &peercred, &so_len) != 0 || + so_len != sizeof(peercred) || + peercred.cr_version != XUCRED_VERSION) + return -1; + *uid = peercred.cr_uid; + *gid = peercred.cr_gid; + return 0; +#elif defined(HAVE_GETPEERUCRED) + /* Solaris: use getpeerucred() */ + ucred_t *ucred; + + ucred = NULL; /* must be initialized to NULL */ + if (getpeerucred(sock, &ucred) == -1) + return -1; + + *uid = ucred_geteuid(ucred); + *gid = ucred_getegid(ucred); + ucred_free(ucred); + + if (*uid == (uid_t) (-1) || *gid == (gid_t) (-1)) + return -1; + return 0; +#else + /* No implementation available on this platform */ + errno = ENOSYS; + return -1; +#endif +} +#endif // HAVE_GETPEEREID diff --git a/fallback.h b/fallback.h index eba91be6c..6898ea576 100644 --- a/fallback.h +++ b/fallback.h @@ -482,3 +482,7 @@ double nan(char *tagp); #endif + +#ifndef HAVE_GETPEEREID +int getpeereid(int sock, uid_t *uid, gid_t *gid); +#endif diff --git a/fish.cpp b/fish.cpp index 7a99ef38f..12d70092c 100644 --- a/fish.cpp +++ b/fish.cpp @@ -62,6 +62,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include "history.h" #include "path.h" #include "input.h" +#include "fish_version.h" /* PATH_MAX may not exist */ #ifndef PATH_MAX @@ -360,7 +361,7 @@ static int fish_parse_opt(int argc, char **argv, std::vector *out_c fwprintf(stderr, _(L"%s, version %s\n"), PACKAGE_NAME, - FISH_BUILD_VERSION); + get_fish_version()); exit_without_destructors(0); } diff --git a/fish.xcodeproj/project.pbxproj b/fish.xcodeproj/project.pbxproj index c7a6abaed..762d73c21 100644 --- a/fish.xcodeproj/project.pbxproj +++ b/fish.xcodeproj/project.pbxproj @@ -57,6 +57,9 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + D00F63F119137E9D00FCCDEC /* fish_version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D00F63F019137E9D00FCCDEC /* fish_version.cpp */; }; + D00F63F219137E9D00FCCDEC /* fish_version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D00F63F019137E9D00FCCDEC /* fish_version.cpp */; }; + D00F63F31914C5F800FCCDEC /* fish_version.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D00F63F019137E9D00FCCDEC /* fish_version.cpp */; }; D01A2D24169B736200767098 /* man1 in Copy Files */ = {isa = PBXBuildFile; fileRef = D01A2D23169B730A00767098 /* man1 */; }; D01A2D25169B737700767098 /* man1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = D01A2D23169B730A00767098 /* man1 */; }; D031890C15E36E4600D9CC39 /* base in Resources */ = {isa = PBXBuildFile; fileRef = D031890915E36D9800D9CC39 /* base */; }; @@ -350,6 +353,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + D00F63F019137E9D00FCCDEC /* fish_version.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = fish_version.cpp; sourceTree = ""; }; D01A2D23169B730A00767098 /* man1 */ = {isa = PBXFileReference; lastKnownFileType = text; name = man1; path = pages_for_manpath/man1; sourceTree = BUILT_PRODUCTS_DIR; }; D025C02715D1FEA100B9DB63 /* completions */ = {isa = PBXFileReference; lastKnownFileType = folder; name = completions; path = share/completions; sourceTree = ""; }; D025C02815D1FEA100B9DB63 /* functions */ = {isa = PBXFileReference; lastKnownFileType = folder; name = functions; path = share/functions; sourceTree = ""; }; @@ -632,6 +636,7 @@ D0A0854113B3ACEE0099B651 /* fish_tests.cpp */, D0A0854213B3ACEE0099B651 /* fish.cpp */, D0A0854313B3ACEE0099B651 /* fishd.cpp */, + D00F63F019137E9D00FCCDEC /* fish_version.cpp */, D0A0851113B3ACEE0099B651 /* highlight.h */, D0A0854713B3ACEE0099B651 /* highlight.cpp */, D0A0851213B3ACEE0099B651 /* history.h */, @@ -1114,6 +1119,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D00F63F31914C5F800FCCDEC /* fish_version.cpp in Sources */, D0D02AC215985F3F008E62BD /* fishd.cpp in Sources */, D0D02AC315985F43008E62BD /* env_universal_common.cpp in Sources */, D0C9733918DE5449002D7C81 /* utf8.cpp in Sources */, @@ -1130,6 +1136,7 @@ D0D02AD615986492008E62BD /* fish_indent.cpp in Sources */, D0D02AD715986498008E62BD /* print_help.cpp in Sources */, D0D02AD81598649E008E62BD /* common.cpp in Sources */, + D00F63F219137E9D00FCCDEC /* fish_version.cpp in Sources */, D0D02AD9159864A6008E62BD /* parser_keywords.cpp in Sources */, D0D02ADA159864AB008E62BD /* wutil.cpp in Sources */, D0D02ADB159864C2008E62BD /* tokenizer.cpp in Sources */, @@ -1161,6 +1168,7 @@ D0D02A69159837B2008E62BD /* env.cpp in Sources */, D0D02A6A1598381A008E62BD /* exec.cpp in Sources */, D0D02A6B1598381F008E62BD /* expand.cpp in Sources */, + D00F63F119137E9D00FCCDEC /* fish_version.cpp in Sources */, D0D02A6C15983829008E62BD /* highlight.cpp in Sources */, D0D02A6D1598382C008E62BD /* history.cpp in Sources */, D0D02A6E15983838008E62BD /* kill.cpp in Sources */, diff --git a/fish_indent.cpp b/fish_indent.cpp index 4560bb961..1332db5e8 100644 --- a/fish_indent.cpp +++ b/fish_indent.cpp @@ -40,6 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include "tokenizer.h" #include "print_help.h" #include "parser_keywords.h" +#include "fish_version.h" /** The string describing the single-character options accepted by the main fish binary @@ -344,7 +345,7 @@ int main(int argc, char **argv) fwprintf(stderr, _(L"%ls, version %s\n"), program_name, - FISH_BUILD_VERSION); + get_fish_version()); exit(0); } diff --git a/fish_tests.cpp b/fish_tests.cpp index 7751763ca..fc8eb569c 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -1867,6 +1867,11 @@ static void test_complete(void) complete(L"echo (builtin scuttlebut", completions, COMPLETION_REQUEST_DEFAULT); do_test(completions.size() == 0); + /* Not after a redirection */ + completions.clear(); + complete(L"echo hi > scuttlebut", completions, COMPLETION_REQUEST_DEFAULT); + do_test(completions.size() == 0); + /* Trailing spaces (#1261) */ complete_add(L"foobarbaz", false, 0, NULL, 0, NO_FILES, NULL, L"qux", NULL, COMPLETE_AUTO_SPACE); completions.clear(); diff --git a/fish_version.cpp b/fish_version.cpp new file mode 100644 index 000000000..e434c3c8e --- /dev/null +++ b/fish_version.cpp @@ -0,0 +1,14 @@ +/** \file fish_version.c Fish version receiver. + + This file has a specific purpose of shortening compilation times when + the only change is different `git describe` version. +*/ + +#include "fish_version.h" + +/** + * Return fish shell version. + */ +const char *get_fish_version() { + return FISH_BUILD_VERSION; +} diff --git a/fish_version.h b/fish_version.h new file mode 100644 index 000000000..61938c16d --- /dev/null +++ b/fish_version.h @@ -0,0 +1,5 @@ +/** \file fish_version.h + Prototype for version receiver. +*/ + +const char *get_fish_version(); diff --git a/fishd.cpp b/fishd.cpp index 02f6f0bf9..4bb80b50c 100644 --- a/fishd.cpp +++ b/fishd.cpp @@ -74,6 +74,7 @@ time the original barrier request was sent have been received. #include "env_universal_common.h" #include "path.h" #include "print_help.h" +#include "fish_version.h" #ifndef HOST_NAME_MAX /** @@ -765,6 +766,8 @@ int main(int argc, char ** argv) int child_socket; struct sockaddr_un remote; socklen_t t; + uid_t sock_euid; + gid_t sock_egid; int max_fd; int update_count=0; @@ -819,7 +822,7 @@ int main(int argc, char ** argv) exit(0); case 'v': - debug(0, L"%ls, version %s\n", program_name, FISH_BUILD_VERSION); + debug(0, L"%ls, version %s\n", program_name, get_fish_version()); exit(0); case '?': @@ -885,7 +888,12 @@ int main(int argc, char ** argv) { debug(4, L"Connected with new child on fd %d", child_socket); - if (make_fd_nonblocking(child_socket) != 0) + if (((getpeereid(child_socket, &sock_euid, &sock_egid) != 0) || sock_euid != geteuid())) + { + debug(1, L"Wrong credentials for child on fd %d", child_socket); + close(child_socket); + } + else if (make_fd_nonblocking(child_socket) != 0) { wperror(L"fcntl"); close(child_socket); diff --git a/history.cpp b/history.cpp index 4f6e9006d..fdbc23594 100644 --- a/history.cpp +++ b/history.cpp @@ -1364,12 +1364,20 @@ bool history_t::save_internal_via_rewrite() for (size_t attempt = 0; attempt < 10 && out_fd == -1; attempt++) { char *narrow_str = wcs2str(tmp_name_template.c_str()); +#if HAVE_MKOSTEMP + out_fd = mkostemp(narrow_str, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC); + if (out_fd >= 0) + { + tmp_name = str2wcstring(narrow_str); + } +#else if (narrow_str && mktemp(narrow_str)) { /* It was successfully templated; try opening it atomically */ tmp_name = str2wcstring(narrow_str); out_fd = wopen_cloexec(tmp_name, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, 0644); } +#endif free(narrow_str); } diff --git a/mimedb.cpp b/mimedb.cpp index fdf5da12d..0a4106b24 100644 --- a/mimedb.cpp +++ b/mimedb.cpp @@ -51,6 +51,7 @@ license. Read the source code of the library for more information. #include "fallback.h" #include "util.h" #include "print_help.h" +#include "fish_version.h" typedef std::vector string_list_t; @@ -619,6 +620,7 @@ static char *get_description(const char *mimetype) perror("read"); error=1; free((void *)contents); + close(fd); return 0; } @@ -1332,7 +1334,7 @@ int main(int argc, char *argv[]) exit(0); case 'v': - printf(_("%s, version %s\n"), MIMEDB, FISH_BUILD_VERSION); + printf(_("%s, version %s\n"), MIMEDB, get_fish_version()); exit(0); case '?': diff --git a/osx/config.h b/osx/config.h index 99f837427..1db2e52c4 100644 --- a/osx/config.h +++ b/osx/config.h @@ -40,6 +40,12 @@ /* Define to 1 if you have the header file. */ #define HAVE_GETOPT_H 1 +/* Define to 1 if you have the `getpeereid' function. */ +#define HAVE_GETPEEREID 1 + +/* Define to 1 if you have the `getpeerucred' function. */ +/* #undef HAVE_GETPEERUCRED */ + /* Define to 1 if you have the `gettext' function. */ /* #undef HAVE_GETTEXT */ diff --git a/output.cpp b/output.cpp index 1f92c32ef..7f90df4bd 100644 --- a/output.cpp +++ b/output.cpp @@ -70,7 +70,7 @@ static const wchar_t *col[]= L"magenta", L"purple", L"cyan", - L"white" + L"white", L"normal" } ; diff --git a/parse_tree.cpp b/parse_tree.cpp index fe1e2527e..4825c6ebc 100644 --- a/parse_tree.cpp +++ b/parse_tree.cpp @@ -1351,7 +1351,7 @@ const parse_node_t *parse_node_tree_t::find_node_matching_source_location(parse_ continue; /* If a parent is given, it must be an ancestor */ - if (parent != NULL && node_has_ancestor(*this, node, *parent)) + if (parent != NULL && ! node_has_ancestor(*this, node, *parent)) continue; /* Found it */ diff --git a/screen.cpp b/screen.cpp index 27b10a5c2..2fd7cc96d 100644 --- a/screen.cpp +++ b/screen.cpp @@ -379,17 +379,6 @@ static size_t calc_prompt_lines(const wcstring &prompt) } return result; } -/** - Test if there is space between the time fields of struct stat to - use for sub second information. If so, we assume this space - contains the desired information. -*/ -static int room_for_usec(struct stat *st) -{ - int res = ((&(st->st_atime) + 2) == &(st->st_mtime) && - (&(st->st_atime) + 4) == &(st->st_ctime)); - return res; -} /** Stat stdout and stderr and save result. @@ -456,11 +445,13 @@ static void s_check_status(screen_t *s) int changed = (s->prev_buff_1.st_mtime != s->post_buff_1.st_mtime) || (s->prev_buff_2.st_mtime != s->post_buff_2.st_mtime); - if (room_for_usec(&s->post_buff_1)) - { - changed = changed || ((&s->prev_buff_1.st_mtime)[1] != (&s->post_buff_1.st_mtime)[1]) || - ((&s->prev_buff_2.st_mtime)[1] != (&s->post_buff_2.st_mtime)[1]); - } + #if defined HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC + changed = changed || s->prev_buff_1.st_mtimespec.tv_nsec != s->post_buff_1.st_mtimespec.tv_nsec || + s->prev_buff_2.st_mtimespec.tv_nsec != s->post_buff_2.st_mtimespec.tv_nsec; + #elif defined HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC + changed = changed || s->prev_buff_1.st_mtim.tv_nsec != s->post_buff_1.st_mtim.tv_nsec || + s->prev_buff_2.st_mtim.tv_nsec != s->post_buff_2.st_mtim.tv_nsec; + #endif if (changed) { diff --git a/share/completions/anamnesis.fish b/share/completions/anamnesis.fish index 8024af4c3..70bd7dba4 100644 --- a/share/completions/anamnesis.fish +++ b/share/completions/anamnesis.fish @@ -1,5 +1,3 @@ -# Completions for anamnesis -# Author: SanskritFritz (gmail) complete -c anamnesis -l version -d "Show program's version number and exit" complete -c anamnesis -s h -l help -d "Show a help message and exit" diff --git a/share/completions/burp.fish b/share/completions/burp.fish new file mode 100644 index 000000000..5c57c7752 --- /dev/null +++ b/share/completions/burp.fish @@ -0,0 +1,7 @@ + +complete -c burp -s u -l user --description 'AUR login username' +complete -c burp -s p -l password --description 'AUR login password' +complete -c burp -s c -l category --description 'Specify CATEGORY for the package' +complete -c burp -s C -l cookies --description 'The path in which to store cookies' +complete -c burp -s k -l keep-cookies --description 'Cookies will be persistent' +complete -c burp -s v -l verbose --description 'Be more verbose' diff --git a/share/completions/cower.fish b/share/completions/cower.fish index dd69934c4..89b0254cd 100644 --- a/share/completions/cower.fish +++ b/share/completions/cower.fish @@ -1,5 +1,3 @@ -# Command specific completions for cower (an Archlinux AUR helper). -# Written by SanskritFritz (gmail) complete -c cower -f -s b -l 'brief' -d 'Show output in a more script friendly format' complete -c cower -f -s d -l 'download' -d 'Download [twice to fetch dependencies]' @@ -15,7 +13,6 @@ complete -c cower -f -s h -l 'help' -d 'Display help and quit' complete -c cower -f -l 'ignore' -xa "(pacman -Qq)" -d 'Ignore a package upgrade' complete -c cower -f -l 'ignorerepo' -xa "(cat /etc/pacman.conf | grep '^\[.\+\]' | sed 's/[]\[]//g')" -d 'Ignore a binary repo when checking for updates' complete -c cower -f -l 'listdelim' -d 'Specify a delimiter for list formatters' -complete -c cower -f -l 'nossl' -d 'No secure http connections to the AUR' complete -c cower -f -s q -l 'quiet' -d 'Output less' complete -c cower -f -s t -l 'target' -d 'Download targets to DIR' complete -c cower -f -l 'threads' -d 'Limit the number of threads created [10]' diff --git a/share/completions/cp.fish b/share/completions/cp.fish index 0415bd866..61bcdee07 100644 --- a/share/completions/cp.fish +++ b/share/completions/cp.fish @@ -1,3 +1,4 @@ + complete -c cp -s a -l archive --description "Same as -dpR" complete -c cp -s b -l backup --description "Make backup of each existing destination file" -a "none off numbered t existing nil simple never" complete -c cp -l copy-contents --description "Copy contents of special files when recursive" @@ -16,12 +17,12 @@ complete -c cp -l version --description "Display version and exit" complete -c cp -s L -l dereference --description "Always follow symbolic links" complete -c cp -s P -l no-dereference --description "Never follow symbolic links" complete -c cp -s p --description "Same as --preserve=mode,ownership,timestamps" -complete -c cp -l preserve --description "Preserve the specified attributes and security contexts, if possible" -a "mode ownership timestamps links all" -complete -c cp -l no-preserve -r --description "Don't preserve the specified attributes" -a "mode ownership timestamps links all" +complete -c cp -f -l preserve --description "Preserve ATTRIBUTES if possible" -xa "mode ownership timestamps links all" +complete -c cp -f -l no-preserve -r --description "Don't preserve ATTRIBUTES" -xa "mode ownership timestamps links all" complete -c cp -l parents --description "Use full source file name under DIRECTORY" complete -c cp -s r -s R -l recursive --description "Copy directories recursively" -complete -c cp -l remove-destination --description "Remove each existing destination file before attempting to open it (contrast with --force)" -complete -c cp -l sparse -r --description "Control creation of sparse files" -a "always auto never" +complete -c cp -l remove-destination --description "First remove existing destination files" +complete -c cp -f -l sparse -r --description "Control creation of sparse files" -xa "always auto never" complete -c cp -s s -l symbolic-link --description "Make symbolic links instead of copying" complete -c cp -s T -l no-target-directory --description "Treat DEST as a normal file" complete -c cp -s x -l one-file-system --description "Stay on this file system" diff --git a/share/completions/duply.fish b/share/completions/duply.fish index 10c3c31b6..1de4bc753 100644 --- a/share/completions/duply.fish +++ b/share/completions/duply.fish @@ -1,5 +1,3 @@ -# Completions for duply -# Author: SanskritFritz (gmail) # First parameter is the profile name, or 'usage' complete --command duply --no-files --condition '__fish_is_first_token' --arguments '(/bin/ls /etc/duply ^/dev/null) (/bin/ls ~/.duply ^/dev/null)' --description 'Profile' diff --git a/share/completions/encfs.fish b/share/completions/encfs.fish new file mode 100644 index 000000000..9deabcfd9 --- /dev/null +++ b/share/completions/encfs.fish @@ -0,0 +1,16 @@ + +complete -c encfs -s i -l idle -d "Unmount when idle for specified MINUTES" +complete -c encfs -s f -d "Run in the foreground" +complete -c encfs -s v -l verbose -d "Verbose messages when run foreground" +complete -c encfs -s s -d "Run in single threaded mode" +complete -c encfs -s d -l fuse-debug -d "Enables debugging within the FUSE library" +complete -c encfs -l forcedecode -d "Return data even from corrupted files" +complete -c encfs -l public -d "Make files public to all other users" +complete -c encfs -l ondemand -d "Mount the filesystem on-demand" +complete -c encfs -l reverse -d "Produce encrypted view of plain files" +complete -c encfs -l standard -d "Use standard options when creating filesystem" +complete -c encfs -s o -d "Pass on options to FUSE" +complete -c encfs -l no-default-flags -d "Don't use the default FUSE flags" +complete -c encfs -l extpass -d "Get password from an external program" +complete -c encfs -s S -l stdinpass -d "Read password from standard input" +complete -c encfs -l anykey -d "Turn off key validation checking" diff --git a/share/completions/fcrontab.fish b/share/completions/fcrontab.fish new file mode 100644 index 000000000..fa7fb3144 --- /dev/null +++ b/share/completions/fcrontab.fish @@ -0,0 +1,17 @@ +# +# Command specific completions for the fcrontab command. +# These completions where generated from the commands +# man page by the make_completions.py script, but may +# have been hand edited since. +# + +complete -c fcrontab -s u --description 'User Specify the user whose fcrontab will be managed, or "systab" for the system fcrontab' +complete -c fcrontab -s l --description 'List user\'s current fcrontab to standard output' +complete -c fcrontab -s e --description 'Edit user\'s current fcrontab using either the editor specified by the environment variable VIS‐ UAL, or EDITOR if VISUAL is not set' +complete -c fcrontab -s r --description 'Remove user\'s fcrontab' +complete -c fcrontab -s z --description 'Reinstall user\'s fcrontab from its source code' +complete -c fcrontab -s n --description 'Ignore previous version' +complete -c fcrontab -s c --description 'File Make fcrontab use config file file instead of default config file /usr/local/etc/fcron' +complete -c fcrontab -s d --description 'Run in debug mode' +complete -c fcrontab -s h --description 'Display a brief description of the options' +complete -c fcrontab -s V --description 'Display an informational message about fcrontab, including its version and the license under which it is distributed' diff --git a/share/completions/gphoto2.fish b/share/completions/gphoto2.fish index d4469f703..00285ead9 100644 --- a/share/completions/gphoto2.fish +++ b/share/completions/gphoto2.fish @@ -1,5 +1,3 @@ -# Command specific completions for gphoto2 -# Written by SanskritFritz (gmail) #Common options complete -c gphoto2 -s '?'-l 'help' -d 'Print complete help message on program usage' diff --git a/share/completions/journalctl.fish b/share/completions/journalctl.fish new file mode 100644 index 000000000..e6e52b1a8 --- /dev/null +++ b/share/completions/journalctl.fish @@ -0,0 +1,26 @@ + +complete -c journalctl -f -s h -l help -d 'Prints a short help text and exits' +complete -c journalctl -f -l version -d 'Prints a short version string and exits' +complete -c journalctl -f -l no-pager -d 'Do not pipe output into a pager' +complete -c journalctl -f -s a -l all -d 'Show all fields in full' +complete -c journalctl -f -s f -l follow -d 'Show live tail of entries' +complete -c journalctl -f -s n -l lines -d 'Controls the number of journal lines' +complete -c journalctl -f -l no-tail -d 'Show all lines, even in follow mode' +complete -c journalctl -f -s o -l output -d 'Controls the formatting' -xa 'short short-monotonic verbose export json json-pretty json-sse cat' +complete -c journalctl -f -s q -l quiet -d 'Suppress warning about normal user' +complete -c journalctl -f -s m -l merge -d 'Show entries interleaved from all journals' +complete -c journalctl -f -s b -l this-boot -d 'Show data only from current boot' +complete -c journalctl -f -s u -l unit -d 'Show data only of the specified unit' -xa "(__fish_systemctl_services)" +complete -c journalctl -f -s p -l priority -d 'Filter by priority' -xa 'emerg 0 alert 1 crit 2 err 3 warning 4 notice 5 info 6 debug 7' +complete -c journalctl -f -s c -l cursor -d 'Start from the passing cursor' +complete -c journalctl -f -l since -d 'Entries on or newer than DATE' -xa 'yesterday today tomorrow now' +complete -c journalctl -f -l until -d 'Entries on or older than DATE' -xa 'yesterday today tomorrow now' +complete -c journalctl -f -s F -l field -d 'Print all possible data values' +complete -c journalctl -f -s D -l directory -d 'Specify journal directory' -xa "(__fish_complete_directories)" +complete -c journalctl -f -l new-id128 -d 'Generate a new 128 bit ID' +complete -c journalctl -f -l header -d 'Show internal header information' +complete -c journalctl -f -l disk-usage -d 'Shows the current disk usage' +complete -c journalctl -f -l setup-keys -d 'Generate Forward Secure Sealing key pair' +complete -c journalctl -f -l interval -d 'Change interval for the sealing' +complete -c journalctl -f -l verify -d 'Check journal for internal consistency' +complete -c journalctl -f -l verify-key -d 'Specifies FSS key for --verify' diff --git a/share/completions/ln.fish b/share/completions/ln.fish index c15d91626..e9ce1ab7f 100644 --- a/share/completions/ln.fish +++ b/share/completions/ln.fish @@ -1,5 +1,3 @@ -# Completions for ln -# Author: SanskritFritz (gmail) complete -c ln -f -s s -l symbolic -d 'Make symbolic links instead of hard links' complete -c ln -f -l backup -a "none off numbered t existing nil simple never" -d 'Make a backup of each existing destination file' diff --git a/share/completions/locate.fish b/share/completions/locate.fish index a932783f9..04aea4dd1 100644 --- a/share/completions/locate.fish +++ b/share/completions/locate.fish @@ -1,5 +1,3 @@ -# Completions for locate -# Author SanskritFritz (gmail) complete -c locate -s A -l 'all' -d 'Match all non-option arguments' complete -c locate -s b -l 'basename' -d 'Match against the base name of the file' diff --git a/share/completions/logkeys.fish b/share/completions/logkeys.fish index 7833eb8c7..62ce14944 100644 --- a/share/completions/logkeys.fish +++ b/share/completions/logkeys.fish @@ -1,5 +1,3 @@ -# Completions for the logkeys command. -# Author: SanskritFritz (gmail) complete -c logkeys -s s -l start -d 'Starts the keylogging daemon' complete -c logkeys -s k -l kill -d 'Terminates the logkeys daemon' diff --git a/share/completions/makepkg.fish b/share/completions/makepkg.fish index 0443a64cd..c811f4630 100644 --- a/share/completions/makepkg.fish +++ b/share/completions/makepkg.fish @@ -1,6 +1,3 @@ -# Completions for makepkg 4, the Archlinux utility to build packages from source -# Author: Giorgio Lando -# SanskritFritz (gmail) complete -c makepkg -l 'asroot' -d 'Allow makepkg to run as root' complete -c makepkg -s A -l 'ignorearch' -d 'Ignore missing or incomplete arch field' diff --git a/share/completions/mc.fish b/share/completions/mc.fish index bb49e3375..0905db283 100644 --- a/share/completions/mc.fish +++ b/share/completions/mc.fish @@ -1,5 +1,3 @@ -# Completions for mc -# Author: SanskritFritz (gmail) complete -c mc -s a -l stickchars -d 'No graphic chars for line drawing' complete -c mc -s b -l nocolor -d 'Force black and white display' diff --git a/share/completions/meat.fish b/share/completions/meat.fish new file mode 100644 index 000000000..8e33c3c34 --- /dev/null +++ b/share/completions/meat.fish @@ -0,0 +1,41 @@ +# Command specific completions for meat (an Archlinux AUR helper). + +set -l listinstalled "(pacman -Qm | tr ' ' \t)" +set -l listall "(pacman -Sl | cut --delim ' ' --fields 2- | tr ' ' \t)" +set -l listrepos "(cat /etc/pacman.conf | grep '^\[.\+\]' | sed 's/[]\[]//g')" +set -l listgroups "(pacman -Sg | sed 's/\(.*\)/\1\tPackage group/g')" + + +# Operations: +complete -c meat -f -s h -l 'help' -d 'Display help and quit' +complete -c meat -f -s d -l 'download' -d 'Download and install targets' +complete -c meat -f -s G -l 'git-db-update' -d 'Update the git database' +complete -c meat -f -s i -l 'info' -d 'Show info for target [twice for more details]' +complete -c meat -f -s s -l 'search' -d 'Search for packages by name' +complete -c meat -f -s m -l 'msearch' -d 'Search for packages by maintainer' +complete -c meat -f -s u -l 'update' -d 'Check for updates and install' +complete -c meat -f -s U -l 'listupdates' -d 'Check for updates and list them' + +# General options: +complete -c meat -f -s f -l 'force' -d 'Continue no matter what [not recommended]' +complete -c meat -f -s g -l 'git-check' -d 'Update checksums for git files' +complete -c meat -f -l 'ignoregit' -xa "$listinstalled" -d 'Ignore PKG when checking for git updates' +complete -c meat -f -l 'ignore' -xa "$listinstalled" -d 'Ignore PKG upgrade' +complete -c meat -f -l 'ignorerepo' -xa "$listrepos" -d 'Ignore REPO when checking for updates' +complete -c meat -f -l 'nossl' -d "Don't use https connections" +complete -c meat -f -l 'sign' -d "GPG sign the resulting package" +complete -c meat -f -l 'nosign' -d "Don't GPG sign the resulting package" +complete -c meat -f -s t -l 'target' -d 'Download targets to DIR' +complete -c meat -f -l 'threads' -d 'Limit the number of threads created [10]' +complete -c meat -f -l 'timeout' -d 'Curl timeout in seconds' +complete -c meat -f -l 'check-all' -d 'Check all files when installing' + +# Output options: +complete -c meat -f -s c -l 'color' -a 'always auto never' -d 'Use colored output' +complete -c meat -f -l 'debug' -d 'Show debug output' +complete -c meat -f -l 'format' -d 'Print formatted' +complete -c meat -f -s q -l 'quiet' -d 'Output less' +complete -c meat -f -s v -l 'verbose' -d 'Output more' + +# Complete with AUR packages: +complete -c meat -f --condition 'not expr (commandline --current-token) : "^-.*" > /dev/null' --arguments '(cower --format="%n\n" --search (commandline --current-token))' diff --git a/share/completions/native2ascii.fish b/share/completions/native2ascii.fish new file mode 100644 index 000000000..0ecac331b --- /dev/null +++ b/share/completions/native2ascii.fish @@ -0,0 +1,4 @@ +# native2ascii +complete -c native2ascii -o reverse --description 'Perform the reverse operation' +complete -c native2ascii -o encoding --description 'Specifies the name of the character encoding' +complete -c native2ascii -o Joption --description 'Pass "option" to JVM' diff --git a/share/completions/obnam.fish b/share/completions/obnam.fish new file mode 100644 index 000000000..1b4616659 --- /dev/null +++ b/share/completions/obnam.fish @@ -0,0 +1,122 @@ + +function nocommand + if commandline | sgrep -qe "add-key\|backup\|client-keys\|clients\|diff\|dump-repo\|force-lock\|forget\|fsck\|generations\|genids\|list-keys\|list-toplevels\|ls\|mount\|nagios-last-backup-age\|remove-client\|remove-key\|restore\|verify" + return 1 + end + return 0 +end + +complete --command obnam --no-files --condition nocommand --arguments 'add-key' --description 'Adds an encryption key to the repository' +complete --command obnam --condition nocommand --arguments 'backup' --description 'Makes a new backup' +complete --command obnam --no-files --condition nocommand --arguments 'client-keys' --description 'Lists the keys associated with each client' +complete --command obnam --no-files --condition nocommand --arguments 'clients' --description 'Lists the clients in the repository' +complete --command obnam --no-files --condition nocommand --arguments 'diff' --description 'Compares two generations' +complete --command obnam --no-files --condition nocommand --arguments 'dump-repo' --description 'Dumps the repository' +complete --command obnam --no-files --condition nocommand --arguments 'force-lock' --description 'Removes a lock file for a client' +complete --command obnam --no-files --condition nocommand --arguments 'forget' --description 'Removes backup generations' +complete --command obnam --no-files --condition nocommand --arguments 'fsck' --description 'Checks the consistency of the repository' +complete --command obnam --no-files --condition nocommand --arguments 'generations' --description 'Lists every backup generation' +complete --command obnam --no-files --condition nocommand --arguments 'genids' --description 'Lists the identifier for every generation' +complete --command obnam --no-files --condition nocommand --arguments 'list-keys' --description 'Lists the keys' +complete --command obnam --no-files --condition nocommand --arguments 'list-toplevels' --description 'Lists the toplevel keys' +complete --command obnam --no-files --condition nocommand --arguments 'ls' --description 'Lists the contents of a given generation' +complete --command obnam --no-files --condition nocommand --arguments 'mount' --description 'Makes the repository available via FUSE' +complete --command obnam --no-files --condition nocommand --arguments 'nagios-last-backup-age' --description 'Check if a backup age exceeds a threshold' +complete --command obnam --no-files --condition nocommand --arguments 'remove-client' --description 'Removes a client from the repository' +complete --command obnam --no-files --condition nocommand --arguments 'remove-key' --description 'Removes a key from the repository' +complete --command obnam --no-files --condition nocommand --arguments 'restore' --description 'Restore files from the repository' +complete --command obnam --no-files --condition nocommand --arguments 'verify' --description 'Verifies files in the repository' + +complete --command obnam --no-files --long-option always-restore-setuid --description 'Restore setuid/setgid bits in restored files' +complete --command obnam --no-files --long-option no-always-restore-setuid --description 'Do not restore setuid/setgid bits in restored files' +complete --command obnam --no-files --long-option client-name --arguments '(hostname)' --description 'Name of client' +complete --command obnam --no-files --long-option compress-with --arguments 'none deflate' --description 'Compress repository with' +complete --command obnam --no-files --long-option critical-age --description 'For --nagios-last-backup-age: maximum age' +complete --command obnam --no-files --long-option dump-repo-file-metadata --description 'Dump metadata about files' +complete --command obnam --no-files --long-option no-dump-repo-file-metadata --description 'Do not dump metadata about files' +complete --command obnam --no-files --long-option generate-manpage --description 'Generate man page' +complete --command obnam --no-files --long-option generation --description 'Which generation to restore' +complete --command obnam --no-files --short-option h --long-option help --description 'Show this help message and exit' +complete --command obnam --no-files --long-option keep --description 'Policy for what generations to keep when forgetting.' +complete --command obnam --no-files --long-option lock-timeout --description 'Wait TIMEOUT seconds for an existing lock' +complete --command obnam --long-option output --description 'Write output to FILE instead of STDOUT' +complete --command obnam --no-files --long-option pretend --long-option dry-run --long-option no-act --description 'Do not actually change anything' +complete --command obnam --no-files --long-option no-pretend --long-option no-dry-run --long-option no-no-act --description 'Actually commit changes' +complete --command obnam --no-files --long-option quiet --description 'Show only errors, no progress updates' +complete --command obnam --no-files --long-option no-quiet --description 'Show errors and progress updates' +complete --command obnam --short-option r --long-option repository --description 'Name of backup repository' +complete --command obnam --long-option root --description 'What to backup' +complete --command obnam --no-files --long-option testing-fail-matching --description 'Simulate failures for files that match REGEXP' +complete --command obnam --long-option to --description 'Where to restore / mount to' +complete --command obnam --long-option trace --description 'FILENAME pattern for trace debugging' +complete --command obnam --no-files --long-option verbose --description 'Be more verbose' +complete --command obnam --no-files --long-option no-verbose --description 'Do not be verbose' +complete --command obnam --no-files --long-option verify-randomly --description 'Verify N files randomly from the backup' +complete --command obnam --no-files --long-option version --description 'Show version number and exit' +complete --command obnam --long-option warn-age --description 'For nagios-last-backup-age: maximum age' +complete --command obnam --no-files --long-option checkpoint --description 'Make a checkpoint after a given SIZE' +complete --command obnam --no-files --long-option deduplicate --arguments 'fatalist never verify' --description 'Deduplicate mode' +complete --command obnam --long-option exclude --description 'REGEXP for pathnames to exclude' +complete --command obnam --no-files --long-option exclude-caches --description 'Exclude directories tagged as cache' +complete --command obnam --no-files --long-option no-exclude-caches --description 'Include directories tagged as cache' +complete --command obnam --long-option exclude-from --description 'Read exclude patterns from FILE.' +complete --command obnam --no-files --long-option leave-checkpoints --description 'Leave checkpoint generations at the end of backup' +complete --command obnam --no-files --long-option no-leave-checkpoints --description 'Omit checkpoint generations at the end of backup' +complete --command obnam --no-files --long-option one-file-system --description 'Do not follow mount points' +complete --command obnam --no-files --long-option no-one-file-system --description 'Follow mount points' +complete --command obnam --no-files --long-option small-files-in-btree --description 'Put small files directly into the B-tree' +complete --command obnam --no-files --long-option no-small-files-in-btree --description 'No not put small files into the B-tree' +complete --command obnam --long-option config --description 'Add FILE to config files' +complete --command obnam --no-files --long-option dump-config --description 'Write out the current configuration' +complete --command obnam --no-files --long-option dump-setting-names --description 'Write out setting names' +complete --command obnam --no-files --long-option help-all --description 'Show all options' +complete --command obnam --no-files --long-option list-config-files --description 'List config files' +complete --command obnam --no-files --long-option no-default-configs --description 'Clear list of configuration files to read' +complete --command obnam --no-files --long-option encrypt-with --description 'PGP key with which to encrypt' +complete --command obnam --no-files --long-option key-details --description 'Show additional user IDs' +complete --command obnam --no-files --long-option no-key-details --description 'Do not show additional user IDs' +complete --command obnam --no-files --long-option keyid --description 'PGP key id' +complete --command obnam --no-files --long-option symmetric-key-bits --description 'Size of symmetric key' +complete --command obnam --no-files --long-option weak-random --description 'Use /dev/urandom instead of /dev/random' +complete --command obnam --no-files --long-option no-weak-random --description 'Use default /dev/random' + +complete --command obnam --no-files --long-option fsck-fix --description 'fsck should try to fix problems' +complete --command obnam --no-files --long-option no-fsck-fix --description 'fsck should not try to fix problems' +complete --command obnam --no-files --long-option fsck-ignore-chunks --description 'Ignore chunks when checking integrity' +complete --command obnam --no-files --long-option no-fsck-ignore-chunks --description 'Check chunks when checking integrity' +complete --command obnam --no-files --long-option fsck-ignore-client --description 'Do not check data for cient NAME.' +complete --command obnam --no-files --long-option fsck-last-generation-only --description 'Check only the last generation' +complete --command obnam --no-files --long-option no-fsck-last-generation-only --description 'Check all generations' +complete --command obnam --no-files --long-option fsck-skip-dirs --description 'Do not check directories' +complete --command obnam --no-files --long-option no-fsck-skip-dirs --description 'Check directories' +complete --command obnam --no-files --long-option fsck-skip-files --description 'Do not check files' +complete --command obnam --no-files --long-option no-fsck-skip-files --description 'Check files' +complete --command obnam --no-files --long-option fsck-skip-generations --description 'Do not check any generations' +complete --command obnam --no-files --long-option no-fsck-skip-generations --description 'Check all generations' +complete --command obnam --no-files --long-option fsck-skip-per-client-b-trees --description 'Do not check per-client B-trees' +complete --command obnam --no-files --long-option no-fsck-skip-per-client-b-trees --description 'Check per-client B-trees' +complete --command obnam --no-files --long-option fsck-skip-shared-b-trees --description 'Do not check shared B-trees' +complete --command obnam --no-files --long-option no-fsck-skip-shared-b-trees --description 'Check shared B-trees' + +complete --command obnam --long-option log --arguments 'syslog' --description 'Write log to FILE or syslog' +complete --command obnam --no-files --long-option log-keep --description 'Keep last N logs (10)' +complete --command obnam --no-files --long-option log-level --arguments 'debug info warning error critical fatal' --description 'Log at LEVEL' +complete --command obnam --no-files --long-option log-max --description 'Rotate logs larger than SIZE' +complete --command obnam --no-files --long-option log-mode --description 'Set permissions of logfiles to MODE' +complete --command obnam --no-files --long-option fuse-opt --description 'Options to pass to FUSE' +complete --command obnam --no-files --long-option dump-memory-profile --arguments 'none simple meliae heapy' --description 'Make memory profiling dumps using METHOD' +complete --command obnam --no-files --long-option memory-dump-interval --description 'Make memory profiling dumps at SECONDS' +complete --command obnam --no-files --long-option chunk-size --description 'Size of chunks of file data' +complete --command obnam --no-files --long-option chunkids-per-group --description 'Encode NUM chunk ids per group' +complete --command obnam --no-files --long-option idpath-bits --description 'Chunk id level size' +complete --command obnam --no-files --long-option idpath-depth --description 'Depth of chunk id mapping' +complete --command obnam --no-files --long-option idpath-skip --description 'Chunk id mapping lowest bits skip' +complete --command obnam --no-files --long-option lru-size --description 'Size of LRU cache for B-tree nodes' +complete --command obnam --no-files --long-option node-size --description 'Size of B-tree nodes on disk' +complete --command obnam --no-files --long-option upload-queue-size --description 'Length of upload queue for B-tree nodes' +complete --command obnam --no-files --long-option pure-paramiko --description 'Use only paramiko, no openssh' +complete --command obnam --no-files --long-option no-pure-paramiko --description 'Use openssh if available' +complete --command obnam --long-option ssh-command --description 'Executable to be used instead of "ssh"' +complete --command obnam --no-files --long-option ssh-host-keys-check --arguments 'no yes ask ssh-config' --description 'ssh host key check' +complete --command obnam --long-option ssh-key --description 'Use FILENAME as the ssh RSA key' +complete --command obnam --long-option ssh-known-hosts --arguments '~/.ssh/known_hosts' --description 'FILENAME of the known_hosts file' diff --git a/share/completions/pacman-key.fish b/share/completions/pacman-key.fish index be69bc240..2f2fbc4fa 100644 --- a/share/completions/pacman-key.fish +++ b/share/completions/pacman-key.fish @@ -1,5 +1,3 @@ -# Completions for pacman-key -# Author: SanskritFritz (gmail) complete -c pacman-key -s a -l 'add' -d 'Add or update keys from ' complete -c pacman-key -l 'config' -d 'Use an alternate config ' diff --git a/share/completions/pbget.fish b/share/completions/pbget.fish index 581c0ce06..75b1b0630 100644 --- a/share/completions/pbget.fish +++ b/share/completions/pbget.fish @@ -1,5 +1,3 @@ -# Completions for the pbget command. -# Author: SanskritFritz (gmail) complete -c pbget -l abs --description 'Use the ABS tree' complete -c pbget -l arch --description 'Set the desired package architecture' diff --git a/share/completions/pdftotext.fish b/share/completions/pdftotext.fish new file mode 100644 index 000000000..9ef0691ad --- /dev/null +++ b/share/completions/pdftotext.fish @@ -0,0 +1,22 @@ + +complete -c pdftotext -s f -d "First page to convert" +complete -c pdftotext -s l -d "Last page to convert" +complete -c pdftotext -s r -d "Resolution, in DPI [75]" +complete -c pdftotext -s x -d "Top left X-coordinate of crop area" +complete -c pdftotext -s y -d "Top left y-coordinate of crop area" +complete -c pdftotext -s W -d "Width of crop area in pixels" +complete -c pdftotext -s H -d "Height of crop area in pixels" +complete -c pdftotext -o layout -d "Maintain original layout" +complete -c pdftotext -o fixed -d "Assume fixed-pitch/tabular text" +complete -c pdftotext -o raw -d "Keep text in content stream order" +complete -c pdftotext -o htmlmeta -d "Generate simple HTML file" +complete -c pdftotext -o bbox -d "Generate XHTML bounding boxes" +complete -c pdftotext -o enc -d "Sets encoding for the output [UTF-8]" +complete -c pdftotext -o listenc -d "Lists the available encodings" +complete -c pdftotext -o eol -d "Sets the end-of-line convention" -xa 'unix dos mac' +complete -c pdftotext -o nopgbrk -d "Don't insert page breaks" +complete -c pdftotext -o opw -d "Specify owner password for the PDF" +complete -c pdftotext -o upw -d "Specify user password for the PDF" +complete -c pdftotext -s q -d "Don't print any messages or errors" +complete -c pdftotext -s v -d "Print copyright and version" +complete -c pdftotext -s h -d "Print usage information" diff --git a/share/completions/readlink.fish b/share/completions/readlink.fish index 692892db6..e2ada369c 100644 --- a/share/completions/readlink.fish +++ b/share/completions/readlink.fish @@ -1,7 +1,3 @@ -# -# Completions for the readlink command. -# SanskritFritz (gmail) -# complete -c readlink -s f -l canonicalize --description 'Canonicalize, follow symlinks, last can be missing' complete -c readlink -s e -l canonicalize-existing --description 'Canonicalize, follow symlinks, none can be missing' diff --git a/share/completions/scrot.fish b/share/completions/scrot.fish index 5cd03e902..8e77ceabc 100644 --- a/share/completions/scrot.fish +++ b/share/completions/scrot.fish @@ -1,11 +1,12 @@ -complete -c scrot -s h -l help -d 'display this help and exit' -complete -c scrot -s v -l version -d 'output version information and exit' -complete -c scrot -s b -l border -d 'When selecting a window, grab wm border too' -complete -c scrot -s c -l count -d 'show a countdown before taking the shot' -complete -c scrot -s d -l delay -x -d 'wait NUM seconds before taking a shot' -complete -c scrot -s e -l exec -d 'run APP on the resulting screenshot' -xa '(complete -C(commandline -ct))' -complete -c scrot -s q -l quality -x -d 'Image quality (1-100) high value means high size, low compression. Default: 75. For lossless compression formats, like png, low quality means high compression.' -complete -c scrot -s m -l multidisp -d 'For multiple heads, grab shot from each and join them together.' -complete -c scrot -s s -l select -d 'interactively choose a window or rectangle with the mouse' -complete -c scrot -s t -l thumb -x -d 'generate thumbnail too. NUM is the percentage of the original size for the thumbnail to be, or the geometry in percent, e.g. 50x60 or 80x20.' +complete -c scrot -s h -l help --description 'Display help and exit' +complete -c scrot -s v -l version --description 'Display version information and exit' +complete -c scrot -s b -l border --description 'When selecting a window, grab wm border too' +complete -c scrot -s c -l count --description 'Display a countdown when used with delay' +complete -c scrot -s d -l delay --description 'Wait NUMBER of seconds before taking a shot' +complete -c scrot -s e -l exec --description 'Execute APPLICATION on the saved image' +complete -c scrot -s q -l quality --description 'Image quality [1-100]' +complete -c scrot -s m -l multidisp --description 'Grab shot from multiple heads' +complete -c scrot -s s -l select --description 'Select a window or rectangle with the mouse' +complete -c scrot -s t -l thumb --description 'Generate thumbnail PERCENT of original' + diff --git a/share/completions/seq.fish b/share/completions/seq.fish index 2d4b2903b..eaf547617 100644 --- a/share/completions/seq.fish +++ b/share/completions/seq.fish @@ -1,5 +1,3 @@ -# Completions for seq. -# Author: SanskritFritz (gmail) complete -c seq -s f -l format -d 'Use printf style floating-point FORMAT' complete -c seq -s s -l separator -d 'Use STRING to separate numbers' diff --git a/share/completions/set.fish b/share/completions/set.fish index 6db28053b..cadbec0f1 100644 --- a/share/completions/set.fish +++ b/share/completions/set.fish @@ -60,7 +60,7 @@ complete -c set -n '__fish_is_first_token' -s x -l export --description "Export complete -c set -n '__fish_is_first_token' -s u -l unexport --description "Do not export variable to subprocess" complete -c set -n '__fish_is_first_token' -s g -l global --description "Make variable scope global" complete -c set -n '__fish_is_first_token' -s l -l local --description "Make variable scope local" -complete -c set -n '__fish_is_first_token' -s U -l universal --description "Make variable scope universal, i.e. share variable with all the users fish processes on this computer" +complete -c set -n '__fish_is_first_token' -s U -l universal --description "Share variable persistently across sessions" complete -c set -n '__fish_is_first_token' -s q -l query --description "Test if variable is defined" complete -c set -n '__fish_is_first_token' -s h -l help --description "Display help and exit" complete -c set -n '__fish_is_first_token' -s n -l names --description "List the names of the variables, but not their value" diff --git a/share/completions/sort.fish b/share/completions/sort.fish index 13ac6aed6..512ad8266 100644 --- a/share/completions/sort.fish +++ b/share/completions/sort.fish @@ -1,10 +1,14 @@ + complete -c sort -s b -l ignore-leading-blanks --description "Ignore leading blanks" complete -c sort -s d -l dictionary-order --description "Consider only blanks and alphanumerics" complete -c sort -s f -l ignore-case --description "Ignore case" complete -c sort -s g -l general-numeric-sort --description "Compare general numeric value" complete -c sort -s i -l ignore-nonprinting --description "Consider only printable" +complete -c sort -s h -l human-numeric-sort --description "Compare human readable numbers [2K 1G]" complete -c sort -s M -l month-sort --description "Compare month names" complete -c sort -s n -l numeric-sort --description "Compare string numerical value" +complete -c sort -s R -l random-sort --description "Sort by random hash of keys" +complete -c sort -l random-source --description "Get random bytes from FILE" complete -c sort -s r -l reverse --description "Reverse results" complete -c sort -s c -l check --description "Only check if sorted" complete -c sort -s k -l key --description "Define key" diff --git a/share/completions/systemctl.fish b/share/completions/systemctl.fish index bd696e594..c9b619083 100644 --- a/share/completions/systemctl.fish +++ b/share/completions/systemctl.fish @@ -1,22 +1,3 @@ -function __fish_systemctl_services - command find /etc/systemd/system -type f -name '*.service' -printf '%f\n' - command find /usr/lib/systemd/system -type f -name '*.service' -printf '%f\n' -end - -function __fish_systemctl_sockets - command find /etc/systemd/system -type f -name '*.socket' -printf '%f\n' - command find /usr/lib/systemd/system -type f -name '*.socket' -printf '%f\n' -end - -function __fish_systemctl_mounts - command find /etc/systemd/system -type f -name '*.mount' -printf '%f\n' - command find /usr/lib/systemd/system -type f -name '*.mount' -printf '%f\n' -end - -function __fish_systemctl_service_paths - command find /etc/systemd/system -type f -name '*.path' -printf '%f\n' - command find /usr/lib/systemd/system -type f -name '*.path' -printf '%f\n' -end function __fish_systemctl_using_command set cmd (commandline -opc) @@ -29,7 +10,7 @@ function __fish_systemctl_using_command end # All systemctl commands -complete -f -c systemctl -n "test (count (commandline -poc)) = 1" -a 'list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump list-dependencies snapshot delete daemon-reload daemon-reexec show-environment set-environment unset-environment default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root' +complete -f -c systemctl -n "test (count (commandline -poc)) = 1" -a 'list-units list-sockets start stop reload restart try-restart reload-or-restart reload-or-try-restart isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump list-dependencies snapshot delete daemon-reload daemon-reexec show show-environment set-environment unset-environment default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root' #### Units commands @@ -74,3 +55,38 @@ complete -f -c systemctl -n '__fish_systemctl_using_command disable' -a '(__fish complete -f -c systemctl -n '__fish_systemctl_using_command disable' -a '(__fish_systemctl_sockets)' -d 'Socket' complete -f -c systemctl -n '__fish_systemctl_using_command disable' -a '(__fish_systemctl_mounts)' -d 'Mount' complete -f -c systemctl -n '__fish_systemctl_using_command disable' -a '(__fish_systemctl_service_paths)' -d 'Path' + +complete -c systemctl -s t -l type -d 'List of unit types' -xa 'help service, mount, socket, target,' +complete -c systemctl -l state -d 'List of unit states' -xa 'LOAD, SUB, ACTIVE,' +complete -c systemctl -s p -l property -d 'Properties displayed in the "show" command' +complete -c systemctl -s a -l all -d 'Show all units or properties' +complete -c systemctl -s r -l recursive -d 'Show also units of local containers' +complete -c systemctl -l reverse -d 'Show reverse dependencies between units' +complete -c systemctl -l after -d 'Show units ordered before specified unit' +complete -c systemctl -l before -d 'Show units ordered after specified unit' +complete -c systemctl -s l -l full -d 'Do not ellipsize anything' +complete -c systemctl -l show-types -d 'Show the type of the socket' +complete -c systemctl -l job-mode -d 'How to deal with queued jobs' -xa 'fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush' +complete -c systemctl -s i -l ignore-inhibitors -d 'Ignore inhibitor locks on shutdown or sleep' +complete -c systemctl -s q -l quiet -d 'Suppress output to STDOUT' +complete -c systemctl -l no-block -d 'Do not wait for the requested operation to finish' +complete -c systemctl -l no-legend -d 'Do not print header and footer' +complete -c systemctl -l user -d 'Talk to the service manager of the calling user' +complete -c systemctl -l system -d 'Talk to the service manager of the system.' +complete -c systemctl -l no-wall -d 'Do not send wall message before halt' +complete -c systemctl -l global -d 'Enable or disable for all users' +complete -c systemctl -l no-reload -d 'Do not reload daemon configuration' +complete -c systemctl -l no-ask-password -d 'Disable asking for password' +complete -c systemctl -l kill-who -d 'Send signal to which process' -xa 'main control all' +complete -c systemctl -s s -l signal -d 'Which signal to send' -xa 'SIGTERM SIGINT SIGSTOP SIGKILL SIGHUP SIGCONT' +complete -c systemctl -s f -l force -d 'Overwrite conflicting existing symlinks' +complete -c systemctl -l root -d 'Use alternative root path' +complete -c systemctl -l runtime -d 'Make changes only temporarily' +complete -c systemctl -s n -l lines -d 'Number of journal lines to show' +complete -c systemctl -s o -l output -d 'Control journal formatting' -xa 'short short-monotonic verbose export json json-pretty json-sse cat' +complete -c systemctl -l plain -d 'list-dependencies flat, not as tree' +complete -c systemctl -s H -l host -d 'Execute the operation remotely' +complete -c systemctl -s M -l machine -d 'Execute operation locally' +complete -c systemctl -s h -l help -d 'Print a short help and exit' +complete -c systemctl -l version -d 'Print a short version and exit' +complete -c systemctl -l no-pager -d 'Do not pipe output into a pager' diff --git a/share/completions/timeout.fish b/share/completions/timeout.fish index 6f40e6854..a1e60768f 100644 --- a/share/completions/timeout.fish +++ b/share/completions/timeout.fish @@ -1,6 +1,3 @@ -# -# Completions for timeout -# SanskritFritz (gmail) complete -c timeout -l foreground -d 'Run COMMAND in the foreground' complete -c timeout -s k -l kill-after -d 'Send a KILL signal after DURATION' diff --git a/share/completions/transmission-remote.fish b/share/completions/transmission-remote.fish new file mode 100644 index 000000000..f72e88950 --- /dev/null +++ b/share/completions/transmission-remote.fish @@ -0,0 +1,79 @@ + +complete -c transmission-remote -s a -l add --description 'Add torrents to transmission' +complete -c transmission-remote -s b -l debug --description 'Enable debugging mode' +complete -c transmission-remote -o as -l alt-speed --description 'Use the alternate Limits' +complete -c transmission-remote -o AS -l no-alt-speed --description 'Don\'t use the alternate Limits' +complete -c transmission-remote -o asd -l alt-speed-downlimit --description 'Limit the alternate download speed' +complete -c transmission-remote -o asu -l alt-speed-uplimit --description 'Limit the alternate upload speed' +complete -c transmission-remote -o asc -l alt-speed-scheduler --description 'Use the scheduled on/off times' +complete -c transmission-remote -o ASC -l no-alt-speed-scheduler --description 'Don\'t use the scheduled on/off times' +complete -c transmission-remote -l alt-speed-time-begin --description 'Time to start using the alt speed limits (in)' +complete -c transmission-remote -l alt-speed-time-end --description 'Time to stop using the alt speed limits (hhmm)' +complete -c transmission-remote -l alt-speed-days --description 'Number of days to enable the speed scheduler' +complete -c transmission-remote -l torrent-done-script --description 'Script to run each time a torrent finishes' +complete -c transmission-remote -l no-torrent-done-script --description 'Don\'t run any script when a torrent finishes' +complete -c transmission-remote -s c -l incomplete-dir --description 'Directory for incomplete downloads' +complete -c transmission-remote -s C -l no-incomplete-dir --description 'Don\'t store incomplete torrents in a different directory' +complete -c transmission-remote -s d -l downlimit --description 'Limit the maximum download speed to limit' +complete -c transmission-remote -s D -l no-downlimit --description 'Disable download speed limits' +complete -c transmission-remote -s e -l cache --description 'Set the session\'s maximum memory cache size (MiB)' +complete -c transmission-remote -o er -l encryption-required --description 'Encrypt all peer connections' +complete -c transmission-remote -o ep -l encryption-preferred --description 'Prefer encrypted peer connections' +complete -c transmission-remote -o et -l encryption-tolerated --description 'Prefer unencrypted peer connections' +complete -c transmission-remote -l exit --description 'Tell the Transmission to initiate a shutdown' +complete -c transmission-remote -s f -l files --description 'Get a file list for the current torrent(s)' +complete -c transmission-remote -s g -l get --description 'Mark file(s) for download' +complete -c transmission-remote -s G -l no-get --description 'Mark file(s) for not downloading' +complete -c transmission-remote -o gsr -l global-seedratio --description 'Ratio All torrents should seed' +complete -c transmission-remote -o GSR -l no-global-seedratio --description 'All torrents should seed regardless of ratio' +complete -c transmission-remote -s h -l help --description 'Print command-line option descriptions' +complete -c transmission-remote -s i -l info --description 'Show details of the current torrent(s)' +complete -c transmission-remote -o si -l session-info --description 'List session information from the server' +complete -c transmission-remote -o st -l session-stats --description 'List statistical information from the server' +complete -c transmission-remote -s l -l list --description 'List all torrents' +complete -c transmission-remote -s m -l portmap --description 'Enable portmapping via NAT-PMP or UPnP' +complete -c transmission-remote -s M -l no-portmap --description 'Disable portmapping' +complete -c transmission-remote -s n -l auth --description 'Set the username:password for authentication' +complete -c transmission-remote -o ne -l authenv --description 'Set the authentication information from $TR_AUTH' +complete -c transmission-remote -s N -l netrc --description 'Set authentication information from a netrc file' +complete -c transmission-remote -s o -l dht --description 'Enable distributed hash table (DHT)' +complete -c transmission-remote -s O -l no-dht --description 'Disable distribued hash table (DHT)' +complete -c transmission-remote -s p -l port --description 'Set the port to use when listening' +complete -c transmission-remote -o Bh -l bandwidth-high --description 'Give this torrent high bandwidth' +complete -c transmission-remote -o Bn -l bandwidth-normal --description 'Give this torrent normal bandwidth' +complete -c transmission-remote -o Bl -l bandwidth-low --description 'Give this torrent low bandwidth' +complete -c transmission-remote -o ph -l priority-high --description 'Try to download the specified files first' +complete -c transmission-remote -o pn -l priority-normal --description 'Try to download the specified files normally' +complete -c transmission-remote -o pl -l priority-low --description 'Try to download the specified files last' +complete -c transmission-remote -o pr -l peers --description 'Set the maximum number of peers' +complete -c transmission-remote -s r -l remove --description 'Remove the current torrents' +complete -c transmission-remote -l remove-and-delete --description 'Remove the current torrents and delete data' +complete -c transmission-remote -l reannounce --description 'Reannounce the current torrents' +complete -c transmission-remote -l move --description 'Move the current torrents\' data to another directory' +complete -c transmission-remote -l find --description 'Where to look for the current torrents\' data' +complete -c transmission-remote -o sr -l seedratio --description 'Current torrents seed until a specific ratio' +complete -c transmission-remote -o SR -l no-seedratio --description 'Current torrents seed regardless of ratio' +complete -c transmission-remote -o srd -l seedratio-default --description 'Current torrents use global seedratio' +complete -c transmission-remote -o td -l tracker-add --description 'Add a tracker to a torrent' +complete -c transmission-remote -o tr -l tracker-remove --description 'Remove a tracker from a torrent' +complete -c transmission-remote -s s -l start --description 'Start the current torrents' +complete -c transmission-remote -s S -l stop --description 'Stop the current torrents' +complete -c transmission-remote -l start-paused --description 'Start added torrents paused' +complete -c transmission-remote -l no-start-paused --description 'Start added torrents unpaused' +complete -c transmission-remote -s t -l torrent --description 'Set torrents as current for subsequent options' +complete -c transmission-remote -l trash-torrent --description 'Delete torrents after adding' +complete -c transmission-remote -l no-trash-torrent --description 'Do not delete torrents after adding' +complete -c transmission-remote -o hl -l honor-session --description 'Current torrents honor session limits' +complete -c transmission-remote -o HL -l no-honor-session --description 'Make the current torrent(s) not honor the session limits' +complete -c transmission-remote -s u -l uplimit --description 'Limit the maximum upload speed (KiB/s)' +complete -c transmission-remote -s U -l no-uplimit --description 'Disable upload speed limits' +complete -c transmission-remote -l utp --description 'Enable uTP for peer connections' +complete -c transmission-remote -l no-utp --description 'Disable uTP for peer connections' +complete -c transmission-remote -s v -l verify --description 'Verify the current torrents' +complete -c transmission-remote -s V -l version --description 'Show version number and exit' +complete -c transmission-remote -s w -l download-dir --description 'Use directory as default for new downloads' +complete -c transmission-remote -s x -l pex --description 'Enable peer exchange (PEX)' +complete -c transmission-remote -s X -l no-pex --description 'Disable peer exchange (PEX)' +complete -c transmission-remote -s y -l lds --description 'Enable local peer discovery (LPD)' +complete -c transmission-remote -s Y -l no-lds --description 'Disable local peer discovery (LPD)' +complete -c transmission-remote -o pi -l peer-info --description 'List the current torrent\'s connected peers' diff --git a/share/functions/__fish_complete_python.fish b/share/functions/__fish_complete_python.fish index 899add7fe..46d2e5d8a 100644 --- a/share/functions/__fish_complete_python.fish +++ b/share/functions/__fish_complete_python.fish @@ -18,7 +18,7 @@ function __fish_complete_python -d 'Make completion for python' --argument-names complete -c $cmd -a "(__fish_complete_suffix .py)" complete -c $cmd -a '-' -d 'Read program from stdin' - switch (eval $cmd -V 2>| sed 's/^.*\s\(.\).*/\1/') + switch (eval $cmd -V 2>&1 | head -n1 | sed 's/^.*\s\([23]\)\..*/\1/') case 2 complete -c $cmd -s 3 -d 'Warn about Python 3.x incompatibilities that 2to3 cannot trivially fix' complete -c $cmd -s t --description "Warn on mixed tabs and spaces" diff --git a/share/functions/__fish_systemctl_mounts.fish b/share/functions/__fish_systemctl_mounts.fish new file mode 100644 index 000000000..706e6ee87 --- /dev/null +++ b/share/functions/__fish_systemctl_mounts.fish @@ -0,0 +1,4 @@ +function __fish_systemctl_mounts + command find /etc/systemd/system -type f -name '*.mount' -printf '%f\n' + command find /usr/lib/systemd/system -type f -name '*.mount' -printf '%f\n' +end diff --git a/share/functions/__fish_systemctl_service_paths.fish b/share/functions/__fish_systemctl_service_paths.fish new file mode 100644 index 000000000..6f8435cf8 --- /dev/null +++ b/share/functions/__fish_systemctl_service_paths.fish @@ -0,0 +1,4 @@ +function __fish_systemctl_service_paths + command find /etc/systemd/system -type f -name '*.path' -printf '%f\n' + command find /usr/lib/systemd/system -type f -name '*.path' -printf '%f\n' +end diff --git a/share/functions/__fish_systemctl_services.fish b/share/functions/__fish_systemctl_services.fish new file mode 100644 index 000000000..a9fd38ba5 --- /dev/null +++ b/share/functions/__fish_systemctl_services.fish @@ -0,0 +1,4 @@ +function __fish_systemctl_services + command find /etc/systemd/system -type f -name '*.service' -printf '%f\n' + command find /usr/lib/systemd/system -type f -name '*.service' -printf '%f\n' +end diff --git a/share/functions/__fish_systemctl_sockets.fish b/share/functions/__fish_systemctl_sockets.fish new file mode 100644 index 000000000..0fe5b6e80 --- /dev/null +++ b/share/functions/__fish_systemctl_sockets.fish @@ -0,0 +1,4 @@ +function __fish_systemctl_sockets + command find /etc/systemd/system -type f -name '*.socket' -printf '%f\n' + command find /usr/lib/systemd/system -type f -name '*.socket' -printf '%f\n' +end diff --git a/share/functions/funced.fish b/share/functions/funced.fish index 3c2de0614..ca2e27721 100644 --- a/share/functions/funced.fish +++ b/share/functions/funced.fish @@ -81,11 +81,7 @@ function funced --description 'Edit function definition' return 0 end - set -q TMPDIR; or set -l TMPDIR /tmp - set -l tmpname (printf "$TMPDIR/fish_funced_%d_%d.fish" %self (random)) - while test -f $tmpname - set tmpname (printf "$TMPDIR/fish_funced_%d_%d.fish" %self (random)) - end + set tmpname (mktemp -t fish_funced.XXXXXXXXXX) if functions -q -- $funcname functions -- $funcname > $tmpname diff --git a/share/functions/psub.fish b/share/functions/psub.fish index 42e34c731..7877aa4ec 100644 --- a/share/functions/psub.fish +++ b/share/functions/psub.fish @@ -45,21 +45,16 @@ function psub --description "Read from stdin into a file and output the filename return end - # Find unique file name for writing output to - while true - set filename /tmp/.psub.(echo %self).(random); - if not test -e $filename - break; - end - end - if test use_fifo = 1 # Write output to pipe. This needs to be done in the background so # that the command substitution exits without needing to wait for # all the commands to exit + set dir (mktemp -d /tmp/.psub.XXXXXXXXXX); or return + set filename $dir/psub.fifo mkfifo $filename cat >$filename & else + set filename (mktemp /tmp/.psub.XXXXXXXXXX) cat >$filename end diff --git a/share/tools/web_config/sample_prompts/debian_chroot.fish b/share/tools/web_config/sample_prompts/debian_chroot.fish new file mode 100644 index 000000000..d800c7441 --- /dev/null +++ b/share/tools/web_config/sample_prompts/debian_chroot.fish @@ -0,0 +1,55 @@ +# name: Debian chroot +# author: Maurizio De Santis + +function fish_prompt --description 'Write out the prompt, prepending the Debian chroot environment if present' + + # Just calculate these once, to save a few cycles when displaying the prompt + if not set -q __fish_prompt_hostname + set -g __fish_prompt_hostname (hostname|cut -d . -f 1) + end + + if not set -q __fish_prompt_normal + set -g __fish_prompt_normal (set_color normal) + end + + if not set -q __fish_prompt_chroot_env + set -g __fish_prompt_chroot_env (set_color yellow) + end + + # Set variable identifying the chroot you work in (used in the prompt below) + if begin; not set -q debian_chroot; and test -r /etc/debian_chroot; end + set debian_chroot (cat /etc/debian_chroot) + end + if begin; not set -q __fish_debian_chroot_prompt; and set -q debian_chroot; and test -n $debian_chroot; end + set -g __fish_debian_chroot_prompt "($debian_chroot)" + end + + # Prepend the chroot environment if present + if set -q __fish_debian_chroot_prompt + echo -n -s "$__fish_prompt_chroot_env" "$__fish_debian_chroot_prompt" "$__fish_prompt_normal" ' ' + end + + switch $USER + + case root + + if not set -q __fish_prompt_cwd + if set -q fish_color_cwd_root + set -g __fish_prompt_cwd (set_color $fish_color_cwd_root) + else + set -g __fish_prompt_cwd (set_color $fish_color_cwd) + end + end + + echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '# ' + + case '*' + + if not set -q __fish_prompt_cwd + set -g __fish_prompt_cwd (set_color $fish_color_cwd) + end + + echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" '> ' + + end +end