From 3909c110e478143de5542d8bd8cae8d4f128ca32 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Tue, 9 Aug 2011 16:57:46 +0200 Subject: [PATCH] #40 adb: Make logcat command log rotation options appear conditionnally --- _adb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/_adb b/_adb index f7eda7f..36681aa 100644 --- a/_adb +++ b/_adb @@ -96,19 +96,18 @@ _adb() { && ret=0 ;; (logcat) - # TODO -n requires the -r option. - # TODO -r requires the -f option. - # Doc here: http://developer.android.com/guide/developing/tools/adb.html#logcat + local -a rotation_opts + [[ -n ${(M)words:#"-f"} ]] && rotation_opts+=('-r[rotates the log file every kbytes of output. The default value is 16]:value (in kb)') + [[ -n ${(M)words:#"-r"} ]] && rotation_opts+=('-n[sets the maximum number of rotated logs. The default value is 4]:count') _arguments \ '-b[loads an alternate log buffer for viewing, such as event or radio. The main buffer is used by default]: :_adb_logcat_buffers' \ '-c[clears (flushes) the entire log and exits]' \ '-d[dumps the log to the screen and exits]' \ '-f[writes log message output to file. The default is stdout]: :_files' \ '-g[prints the size of the specified log buffer and exits]' \ - '-n[sets the maximum number of rotated logs. The default value is 4]:count' \ - '-r[rotates the log file every kbytes of output. The default value is 16]:value (in kb)' \ '-s[sets the default filter spec to silent]' \ '-v[sets the output format for log messages]: :_adb_logcat_output_formats' \ + "${rotation_opts[@]}" \ '*: :_adb_logcat_filter_specs' \ && ret=0 ;;