view mercurial/fancyopts.py @ 661:148f642d1f8e

Add rss tag in the changelog/filelog html template. # HG changeset patch # User kreijack@inwind.REMOVEME.it # Node ID 20edcc82038fce8460076ca5723fbbb919016356 # Parent 8c89408a7154d2da94766e957a088407fd0fef93 Add rss tag in the changelog/filelog html template. This patch add rss tags in the changelog/filelog template html pages. This tags permit the browser to detect the rss feed.
author kreijack@inwind.REMOVEME.it
date Sun, 10 Jul 2005 15:59:26 -0800
parents d2994b5298fb
children 31a9aa890016
line wrap: on
line source

import os, getopt

def fancyopts(args, options, state):
    long=[]
    short=''
    map={}
    dt={}

    for s, l, d, c in options:
        map['-'+s] = map['--'+l]=l
        state[l] = d
        dt[l] = type(d)
        if not d is None and not callable(d): s, l=s+':', l+'='
        if s: short = short + s
        if l: long.append(l)

    opts, args = getopt.getopt(args, short, long)

    for opt, arg in opts:
        if dt[map[opt]] is type(fancyopts): state[map[opt]](state,map[opt],arg)
        elif dt[map[opt]] is type(1): state[map[opt]] = int(arg)
        elif dt[map[opt]] is type(''): state[map[opt]] = arg
        elif dt[map[opt]] is type([]): state[map[opt]].append(arg)
        elif dt[map[opt]] is type(None): state[map[opt]] = 1

    return args