zsh-histdb

Check-in [385f025876]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:better long option handling
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 385f025876eb2d82d18a0e4f085771051c7d3387e58dd7715d4d38bd2fc0f35e
User & Date: tom.hinton@cse.org.uk 2017-04-19 14:37:20
Context
2017-04-25
14:12
Update sqlite-history.zsh check-in: 3eed9833e5 user: noreply@github.com tags: master, trunk
2017-04-19
14:37
better long option handling check-in: 385f025876 user: tom.hinton@cse.org.uk tags: master, trunk
14:34
Use dirname not basename here check-in: f796c73c8c user: tom.hinton@cse.org.uk tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to sqlite-history.zsh.

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
...
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
        done
        where="${where}${sin:+ and session in ($sin)}"
    fi

    local debug=0
    for opt ($opts); do
        case $opt in
            --from=*)
                local from=${opt#--from=}
                case $from in
                    -*)
                        from="datetime('now', '$from')"
                        ;;
                    today)
                        from="datetime('now', 'start of day')"
                        ;;
                    yesterday)
                        from="datetime('now', 'start of day', '-1 day')"
                        ;;
                esac
                where="${where} and datetime(start_time, 'unixepoch') >= $from"
            ;;
            --until=*)
                local until=${opt#--until=}
                case $until in
                    -*)
                        until="datetime('now', '$until')"
                        ;;
                    today)
                        until="datetime('now', 'start of day')"
                        ;;
................................................................................
            -d)
                debug=1
                ;;
            -h|--help)
                echo "$usage"
                return 0
                ;;
            --limit=*)
                limit=${opt#--limit=}
                ;;
        esac
    done

    sep=$'\x1f'
    cols="${cols}, replace(commands.argv, '
', '







|
|













|
|







 







|
|







202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
...
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
        done
        where="${where}${sin:+ and session in ($sin)}"
    fi

    local debug=0
    for opt ($opts); do
        case $opt in
            --from*)
                local from=${opt#--from}
                case $from in
                    -*)
                        from="datetime('now', '$from')"
                        ;;
                    today)
                        from="datetime('now', 'start of day')"
                        ;;
                    yesterday)
                        from="datetime('now', 'start of day', '-1 day')"
                        ;;
                esac
                where="${where} and datetime(start_time, 'unixepoch') >= $from"
            ;;
            --until*)
                local until=${opt#--until}
                case $until in
                    -*)
                        until="datetime('now', '$until')"
                        ;;
                    today)
                        until="datetime('now', 'start of day')"
                        ;;
................................................................................
            -d)
                debug=1
                ;;
            -h|--help)
                echo "$usage"
                return 0
                ;;
            --limit*)
                limit=${opt#--limit}
                ;;
        esac
    done

    sep=$'\x1f'
    cols="${cols}, replace(commands.argv, '
', '