File: update_gui_help

package info (click to toggle)
espresso 5.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 146,004 kB
  • ctags: 17,245
  • sloc: f90: 253,041; sh: 51,271; ansic: 27,494; tcl: 15,570; xml: 14,508; makefile: 2,958; perl: 2,035; fortran: 1,924; python: 337; cpp: 200; awk: 57
file content (64 lines) | stat: -rwxr-xr-x 1,475 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

#
# Usage:   update_gui_help module
#          ( module = pw, ph, pp, neb, projwfc, dos, bands, atomic, or d3 )
#
# Requirements: execute the check_gui first !!!
#             
# Purpose: updates the PWgui help file, i.e., moves the
#          module-help.tcl file that has been created by prior
#          execution of check_gui to $topdir/GUI/PWgui/modules/$module/
#

proc Usage {} {
    global argv0

    puts stderr [subst {
  Usage: $argv0 module
  
  Where module is one of:
  
  \tpw
  \tph 
  \tneb
  \tpp 
  \tprojwfc
  \tdos
  \tbands
  \tatomic
  \td3
    }]
    exit 1
}

if { $argc != 1 } {
    Usage
}

set module  [lindex $argv 0]
set basedir [file normalize [file dirname [info script]]]
set topdir  [file normalize [file join $basedir ..]]

# PWgui's modules dir 

set pwguidir  [file join $topdir GUI PWgui]
set moduledir [file join $pwguidir modules]

if { ! [file exists $module-help.tcl] } {
    puts stderr "ERROR: run the \"check_gui $module\" first ..."
    exit 1
}

puts "* moving $module-help.tcl --> [file join $moduledir $module $module-help.tcl]"

file rename -force $module-help.tcl [file join $moduledir $module $module-help.tcl]

if { [file exists [file join $moduledir $module $module-help.tcl.bak]] } {
    puts "* removing backup file: [file join $moduledir $module $module-help.tcl.bak]"
}

# ok, we are done; since we loaded Tk, we need an explicit exit !!!
exit 0