mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-22 04:13:33 +01:00
Added autocompletion in irpman
This commit is contained in:
parent
f1d3eba3bc
commit
b5499b8a2f
36
bin/irpman
36
bin/irpman
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/bin/bash
|
||||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||||
# the Implicit Reference to Parameters (IRP) method.
|
# the Implicit Reference to Parameters (IRP) method.
|
||||||
# Copyright (C) 2009 Anthony SCEMAMA
|
# Copyright (C) 2009 Anthony SCEMAMA
|
||||||
@ -24,19 +24,25 @@
|
|||||||
# 31062 Toulouse Cedex 4
|
# 31062 Toulouse Cedex 4
|
||||||
# scemama@irsamc.ups-tlse.fr
|
# scemama@irsamc.ups-tlse.fr
|
||||||
|
|
||||||
|
# Define auto-completion for bash
|
||||||
|
|
||||||
import os
|
case "$0" in
|
||||||
import sys
|
*bash*)
|
||||||
|
_irpman_complete()
|
||||||
wd = os.path.abspath(os.path.dirname(__file__))
|
{
|
||||||
sys.path.insert(0,(wd+"/../src/"))
|
local cur
|
||||||
sys.path.insert(0,(wd+"/../share/irpf90/src/"))
|
COMPREPLY=()
|
||||||
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
if len(sys.argv) != 2:
|
COMPREPLY=( $(compgen -W "`cat irpf90_entities | cut -d':' -f 4 | cut -d ' ' -f 2`" -- "$cur" ) )
|
||||||
print "Usage:"
|
} && complete -F _irpman_complete irpman
|
||||||
print sys.argv[0]+" <irp_variable>"
|
;;
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
from irpf90_t import mandir
|
|
||||||
os.system("man ./"+mandir+sys.argv[1].lower()+".l")
|
|
||||||
|
|
||||||
|
*)
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "To activate auto-completion in bash:"
|
||||||
|
echo "source $(which irpman)"
|
||||||
|
else
|
||||||
|
python $(dirname $0)/../src/irpman.py $1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
39
src/irpman.py
Executable file
39
src/irpman.py
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||||
|
# the Implicit Reference to Parameters (IRP) method.
|
||||||
|
# Copyright (C) 2009 Anthony SCEMAMA
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
# Anthony Scemama
|
||||||
|
# LCPQ - IRSAMC - CNRS
|
||||||
|
# Universite Paul Sabatier
|
||||||
|
# 118, route de Narbonne
|
||||||
|
# 31062 Toulouse Cedex 4
|
||||||
|
# scemama@irsamc.ups-tlse.fr
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
wd = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
from irpf90_t import mandir
|
||||||
|
filename = sys.argv[1].lower()+".l"
|
||||||
|
if filename not in os.listdir(mandir):
|
||||||
|
print "%s does not exist"%(sys.argv[1])
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
|
os.system("man ./"+mandir+sys.argv[1].lower()+".l")
|
||||||
|
|
@ -1 +1 @@
|
|||||||
version = "1.3.00"
|
version = "1.3.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user