fish-shell/doc_src/cmds
Fabian Boehm 41c22d5e60 Add string shorten
This is essentially the inverse of `string pad`.
Where that adds characters to get up to the specified width,
this adds an ellipsis to a string if it goes over a specific maximum width.
The char can be given, but defaults to our ellipsis string.
("…" if the locale can handle it and "..." otherwise)

If the ellipsis string is empty, it just truncates.

For arguments given via argv, it goes line-by-line,
because otherwise length makes no sense.

If "--no-newline" is given, it adds an ellipsis instead and removes all subsequent lines.

Like pad and `length --visible`, it goes by visible width,
skipping recognized escape sequences, as those have no influence on width.

The default target width is the shortest of the given widths that is non-zero.

If the ellipsis is already wider than the target width,
we truncate instead. This is safer overall, so we don't e.g. move into a new line.
This is especially important given our default ellipsis might be width 3.
2022-09-09 18:49:57 +02:00
..
_.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
abbr.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
alias.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
and.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
argparse.rst argparse: Allow usage without optspecs 2022-06-27 17:02:20 +02:00
begin.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
bg.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
bind.rst Fix typo for or input function 2022-08-05 18:32:32 +02:00
block.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
break.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
breakpoint.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
builtin.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
case.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
cd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
cdh.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
command.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
commandline.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
complete.rst Allow complete to have multiple conditions 2022-05-30 20:47:14 +02:00
contains.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
continue.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
count.rst docs synopsis: make all placeholder arguments uppercase 2022-01-19 22:56:41 +08:00
dirh.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
dirs.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
disown.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
echo.rst docs: removed enumeration item from echo docs 2022-04-22 20:16:14 +02:00
else.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
emit.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
end.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
eval.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
exec.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
exit.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
false.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fg.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_add_path.rst docs: Link some more to $PATH 2022-07-18 20:53:37 +02:00
fish_breakpoint_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_command_not_found.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_config.rst Fix copy-pasteo in fish_config docs 2022-06-17 09:23:38 +02:00
fish_git_prompt.rst fish_git_prompt: Print cleanstate character whenever it's defined 2022-06-08 21:23:43 +02:00
fish_greeting.rst docs: Link fish_greeting function from FAQ 2022-07-18 20:52:16 +02:00
fish_hg_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_indent.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_is_root_user.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_key_reader.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_mode_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_opt.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_prompt.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_right_prompt.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
fish_status_to_signal.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_svn_prompt.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
fish_title.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_update_completions.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
fish_vcs_prompt.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
for.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
funced.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
funcsave.rst Put funcsave long option back 2022-03-24 20:11:39 +01:00
function.rst docs: list reserved keywords 2022-06-16 19:45:55 +10:00
functions.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
help.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
history.rst docs: standardise on definition lists for options 2022-03-12 00:21:12 +08:00
if.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
isatty.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
jobs.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
math.rst Fix typo 2022-09-08 22:50:28 +02:00
nextd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
not.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
open.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
or.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
path.rst docs: Format path synopsis 2022-08-25 13:06:57 +02:00
popd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
prevd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
printf.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
prompt_hostname.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
prompt_login.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
prompt_pwd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
psub.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
pushd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
pwd.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
random.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
read.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
realpath.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
return.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
set.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
set_color.rst set_color: Print the given colors with --print-colors 2022-07-01 21:28:35 +02:00
source.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
status.rst Document that status fish-path is platform-specific 2022-06-16 16:39:09 +02:00
string-collect.rst Fix more lost string documentation 2022-05-14 10:05:02 +02:00
string-escape.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-join.rst New -n flag for string join. (#8774) 2022-03-13 11:47:33 +01:00
string-join0.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
string-length.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-lower.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-match.rst Fix more lost string documentation 2022-05-14 10:05:02 +02:00
string-pad.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-repeat.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-replace.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-shorten.rst Add string shorten 2022-09-09 18:49:57 +02:00
string-split.rst Docs: be more consistent about argument formatting 2022-05-14 10:05:02 +02:00
string-split0.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
string-sub.rst Fix more lost string documentation 2022-05-14 10:05:02 +02:00
string-trim.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string-unescape.rst We no longer have two doc systems, move sphinx_doc_src back to doc_src 2020-02-19 17:00:35 -08:00
string-upper.rst string docs: format options and arguments in line with other pages 2022-03-12 22:22:02 +08:00
string.rst Add string shorten 2022-09-09 18:49:57 +02:00
suspend.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
switch.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
test.rst Document the three new [ operators 2022-07-16 12:40:36 -07:00
time.rst docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
trap.rst Allow trapping SIGINT and SIGTERM in scripts 2022-05-28 17:44:13 -07:00
true.rst help: Handle the missing builtin aliases : and [ 2022-08-12 20:45:20 +02:00
type.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
ulimit.rst ulimit: add new limits from FreeBSD/NetBSD 2022-03-24 10:23:04 +08:00
umask.rst docs: standardise on definition lists for options 2022-03-12 00:21:12 +08:00
vared.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
wait.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00
while.rst docs: omnibus cleanup 2022-03-12 00:21:13 +08:00