File: status-command.fish

package info (click to toggle)
fish 4.2.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,976 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (58 lines) | stat: -rw-r--r-- 1,248 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#RUN: env FISH_PATH=%fish FILE_PATH=%s %fish %s

status line-number
# CHECK: 3

# Check status fish-path
# No output expected on success
#
# argv[0] on OpenBSD is just the filename, not the path
# That means fish-path is unsupportable there.
if not contains (uname) OpenBSD
    set status_fish_path (realpath (status fish-path))
    set env_fish_path (realpath $FISH_PATH)
    test "$status_fish_path" = "$env_fish_path"
    or echo "Fish path disagreement: $status_fish_path vs $env_fish_path"
end

# Check is-block
status is-block
echo $status
begin
    status is-block
    echo $status
end
# CHECK: 1
# CHECK: 0

# Check filename
set status_filename (status filename)
test (status filename) = "$FILE_PATH"
or echo "File path disagreement: $status_filename vs $FILE_PATH"

function print_my_name
    status function
end
print_my_name
# CHECK: print_my_name

status is-command-substitution
echo $status
echo (status is-command-substitution; echo $status)
# CHECK: 1
# CHECK: 0

test (status filename) = (status dirname)/(status basename)

status basename
#CHECK: status-command.fish

status dirname | string match -q '*checks'
echo $status
#CHECK: 0

echo "status dirname" | source
#CHECK: .

$FISH_PATH -c 'status dirname'
#CHECK: Standard input