# Copyright (c) 2013-2020, SIB - Swiss Institute of Bioinformatics and
#                          Biozentrum - University of Basel
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#   http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


'''
Just list all actions (pm-.* files) available.
'''

import os
import sys
import glob

def main():
    '''
    Executed if called as script.
    We first fetch the path to the action scripts based on this file. This
    directory is than scanned for all files which come with a 'pm-' prefix.
    Those file names (without the 'pm-') are reported back to the user.
    '''
    # determine path of the help script
    action_path = os.path.abspath(os.path.dirname(sys.argv[0]))
    sys.stdout.write('Following actions are available:\n')
    for action in sorted(glob.glob(os.path.join(action_path, 'pm-*'))):
        sys.stdout.write("  %s\n" % action[len(action_path)+4:])
    sys.stdout.write('Each action should respond to "--help".\n')

if __name__ == '__main__':
    main()

## Emacs magic
# Local Variables:
# mode: python
# End:

#  LocalWords:  os sys argv len
