* [PATCH 1/2] _zfs_dataset: only use -t share solaris systems
@ 2015-09-26 18:00 Eric Cook
2015-09-26 18:00 ` [PATCH 2/2] _zfs: complete jail/unjail subcommands on freebsd Eric Cook
2015-09-26 19:10 ` [PATCH 1/2 v2] _zfs_dataset: only use -t share solaris systems Eric Cook
0 siblings, 2 replies; 3+ messages in thread
From: Eric Cook @ 2015-09-26 18:00 UTC (permalink / raw)
To: zsh-workers
On non-solaris systems with zfs, zfs rename <tab> will print an help
message due to -t share.
The test will work on linux, os x and freebsd. but illumos systems
between the years 2010-2012 will still be identified as solaris
telling the difference between illumos and solaris isn't very
straightforward it seems.
http://wiki.illumos.org/display/illumos/Modernizing+Uname
I added _pick_variant in _zfs/_zpool and not _zfs_dataset to help with
other differences between openzfs and solaris' zfs. In the future
someone could test $implementation and handle things appropriately.
---
Completion/Unix/Command/_zfs | 4 +++-
Completion/Unix/Command/_zpool | 4 +++-
Completion/Unix/Type/_zfs_dataset | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index cd5ad3e..04a92e6 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -2,7 +2,7 @@
# Synced with the S11U1 man page
_zfs() {
- local context state line expl
+ local context state line expl implementation
typeset -A opt_args
local -a subcmds rw_properties rw_propnames ro_properties create_properties
local -a share_nfs_ro_properties share_nfs_rw_properties
@@ -10,6 +10,8 @@ _zfs() {
local -a share_ro_properties share_rw_properties
local -a difffields delegatable_perms
+ _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
+
subcmds=(
"create" "destroy" "clone" "promote" "rename" "snapshot"
"rollback" "list" "set" "get" "inherit" "mount" "unmount"
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
index f2116dc..53022db 100644
--- a/Completion/Unix/Command/_zpool
+++ b/Completion/Unix/Command/_zpool
@@ -2,9 +2,11 @@
# Synced with the S11U1 man page
_zpool() {
- local context state line expl
+ local context state line expl implementation
local -a subcmds fields ro_props rw_props versions create_properties_dataset
+ _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
+
subcmds=(
create destroy add remove list iostat status online
offline clear attach detach replace scrub import export
diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset
index 64e343f..a1fde90 100644
--- a/Completion/Unix/Type/_zfs_dataset
+++ b/Completion/Unix/Type/_zfs_dataset
@@ -34,6 +34,8 @@ if [[ ${#rsrc} -gt 0 ]]; then
typearg=( -t snapshot )
elif [[ -n $words[(r)-p] ]]; then
typearg=( -t filesystem,volume )
+ elif [[ $implementation == openzfs ]]; then
+ typearg=( -t filesystem,snapshot,volume )
else
typearg=( -t filesystem,share,snapshot,volume )
fi
--
2.5.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] _zfs: complete jail/unjail subcommands on freebsd
2015-09-26 18:00 [PATCH 1/2] _zfs_dataset: only use -t share solaris systems Eric Cook
@ 2015-09-26 18:00 ` Eric Cook
2015-09-26 19:10 ` [PATCH 1/2 v2] _zfs_dataset: only use -t share solaris systems Eric Cook
1 sibling, 0 replies; 3+ messages in thread
From: Eric Cook @ 2015-09-26 18:00 UTC (permalink / raw)
To: zsh-workers
---
Completion/Unix/Command/_zfs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index 04a92e6..f3869da 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -20,6 +20,8 @@ _zfs() {
"diff" "key" "help"
)
+ [[ $OSTYPE == freebsd<7->.* ]] && subcmds+=(jail unjail)
+
share_nfs_ro_properties=(
"share.nfs.all"
)
@@ -533,6 +535,12 @@ _zfs() {
':filesystem or volume:_zfs_dataset -t fs -t vol'
;;
+ ("jail"|"unjail")
+ _arguments \
+ '1: : _jails' \
+ '2:filesystem:_zfs_dataset -t fs'
+ ;;
+
("help")
_arguments -A "-*" \
- set1 \
--
2.5.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2 v2] _zfs_dataset: only use -t share solaris systems
2015-09-26 18:00 [PATCH 1/2] _zfs_dataset: only use -t share solaris systems Eric Cook
2015-09-26 18:00 ` [PATCH 2/2] _zfs: complete jail/unjail subcommands on freebsd Eric Cook
@ 2015-09-26 19:10 ` Eric Cook
1 sibling, 0 replies; 3+ messages in thread
From: Eric Cook @ 2015-09-26 19:10 UTC (permalink / raw)
To: zsh-workers
in addition to the previously mentioned stuff, avoids the
solaris specific type alias `fs' in favor of `filesystem' in _zfs_dataset.
which is used when completing the destination of an zfs rename command.
---
Completion/Unix/Command/_zfs | 4 +++-
Completion/Unix/Command/_zpool | 4 +++-
Completion/Unix/Type/_zfs_dataset | 6 ++++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index cd5ad3e..04a92e6 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -2,7 +2,7 @@
# Synced with the S11U1 man page
_zfs() {
- local context state line expl
+ local context state line expl implementation
typeset -A opt_args
local -a subcmds rw_properties rw_propnames ro_properties create_properties
local -a share_nfs_ro_properties share_nfs_rw_properties
@@ -10,6 +10,8 @@ _zfs() {
local -a share_ro_properties share_rw_properties
local -a difffields delegatable_perms
+ _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
+
subcmds=(
"create" "destroy" "clone" "promote" "rename" "snapshot"
"rollback" "list" "set" "get" "inherit" "mount" "unmount"
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
index f2116dc..53022db 100644
--- a/Completion/Unix/Command/_zpool
+++ b/Completion/Unix/Command/_zpool
@@ -2,9 +2,11 @@
# Synced with the S11U1 man page
_zpool() {
- local context state line expl
+ local context state line expl implementation
local -a subcmds fields ro_props rw_props versions create_properties_dataset
+ _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
+
subcmds=(
create destroy add remove list iostat status online
offline clear attach detach replace scrub import export
diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset
index 64e343f..5fa3e9e 100644
--- a/Completion/Unix/Type/_zfs_dataset
+++ b/Completion/Unix/Type/_zfs_dataset
@@ -34,6 +34,8 @@ if [[ ${#rsrc} -gt 0 ]]; then
typearg=( -t snapshot )
elif [[ -n $words[(r)-p] ]]; then
typearg=( -t filesystem,volume )
+ elif [[ $implementation == openzfs ]]; then
+ typearg=( -t filesystem,snapshot,volume )
else
typearg=( -t filesystem,share,snapshot,volume )
fi
@@ -50,13 +52,13 @@ if [[ ${#rdst} -gt 0 ]]; then
else
# The parent dataset must be a filesystem, and can't rename
# a dataset into another pool. Plus we hardcode the expl.
- typearg=( -t fs -r ${${words[CURRENT - 1]}%%/*} )
+ typearg=( -t filesystem -r ${${words[CURRENT - 1]}%%/*} )
expl_type_arr=( -e "parent dataset" )
fi
fi
if [[ -n $type[(r)clone] ]]; then
- datasetlist=( ${="$(zfs list -H -o name,origin -t fs | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
+ datasetlist=( ${="$(zfs list -H -o name,origin -t filesystem | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
else
datasetlist=( ${="$(zfs list -H -o name $typearg)":#no datasets available} )
fi
--
2.5.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-26 19:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-26 18:00 [PATCH 1/2] _zfs_dataset: only use -t share solaris systems Eric Cook
2015-09-26 18:00 ` [PATCH 2/2] _zfs: complete jail/unjail subcommands on freebsd Eric Cook
2015-09-26 19:10 ` [PATCH 1/2 v2] _zfs_dataset: only use -t share solaris systems Eric Cook
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).