about summary refs log tree commit diff
path: root/Completion/User/_netscape
blob: 3caaad05e1d26067527a9d9b917421fd1c0c2cad (plain) (blame)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#compdef netscape

local context state line ret=1
typeset -A opt_args

_x_arguments \
  '-xrm:resource:_x_resource' \
  '-help[show usage message]' \
  '-version[show the version number and build date]' \
  '-visual[use a specific server visual]:id-or-number:' \
  '-install[install a private colormap]' \
  '-no-install[use the default colormap]' \
  '-ncols[max no. of colors to allocate for images]:n:' \
  '-mono[force 1-bit-deep image display]' \
  '-iconic[start up iconified]' \
  '-remote[execute a command in an existing Netscape]:remote command:->remote' \
  '-id[id of X window to send remote commands to]:window-id:' \
  '-raise[raise window following remote command]' \
  "-noraise[don't raise window following remote command]" \
  '-nethelp[show nethelp]' \
  -{dont-force-window-stacking,no-about-splash} \
  -{,no-}{,irix-}session-management \
  -{done-save,ignore}-geometry-prefs \
  -{component-bar,composer,edit,messenger,mail,discussions,news} \
  '*:location:->urls' && ret=0

[[ "$state" = "urls" ]] &&
  _tags "$context" files && _files "$@" && return 0


# Handle netscape remote commands
if [[ "$state" = "remote" ]]; then  
  local -a remote_commands
  remote_commands=(openURL openFile saveAs mailto addBookmark)

  [[ $compstate[quoting] = (double|single) ]] && compset -q
  compset -P '*\('
  case $IPREFIX in
    openURL*|addBookmark*) state=urls;;
    openFile*) _files -W ~;;
    saveAs*) 
      if compset -P "*,"; then
        if _tags "$context" types; then
          _description expl 'data type'
          compadd -s")" -M 'm:{a-zA-Z}={A-Za-z}' HTML Text PostScript &&
              ret=0
        fi
      else
        _tags "$context" files && _path_files -W ~ && ret=0
      fi
    ;;
    mailto*)
      compset -P "*,"
      if compset -P '*@'; then
        if _tags "$context" hosts; then
          _description expl 'remote host name'
          _hosts "$expl[@]" -q -S, && ret=0
        fi
      else
        if _tags "$context" users; then
          _description expl 'login name'
          _users "$expl[@]" -q -S@ && ret=0
        fi
      fi
    ;;
    *)
      if _tags "$context" commands; then
        if [[ "$QIPREFIX" ]]; then
          compadd -q -S '(' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands && ret=0
        else
	  compadd -s'(' -S '' -M 'm:{a-zA-Z}={A-Za-z}' $remote_commands && ret=0
	fi
      fi
    ;;
  esac
fi

if [[ "$state" = "urls" ]]; then
  # Complete netscape urls
  if [[ -prefix about: ]]; then
    if _tags "$context" values; then
      _description expl 'about what'
      compset -P about:
      compadd authors blank cache document fonts global hype image-cache \
          license logo memory-cache mozilla plugins && ret=0
    fi
  else
    if _tags "$context" prefixes; then
      _description expl 'URL prefix'
      compadd "$expl[@]" -S '' about: mocha: javascript:
      _urls "$@" && ret=0
    fi
  fi
fi

return ret