mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Script: Add pamhyr2 script with exemple hello.
This commit is contained in:
1 parent
75066fa61a
commit
d4568ddbb5
3 files changed
+100
-3
No files matched your search
@@ -0,0 +1,34 @@
|
||||
# AScript.py -- Pamhyr abstract script class
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
class AScript(object):
|
||||
name = ""
|
||||
description = ""
|
||||
|
||||
def __init__(self, args):
|
||||
super(AScript, self).__init__()
|
||||
|
||||
self._args = args.copy()
|
||||
|
||||
def usage(self):
|
||||
raise NotImplementedMethodeError(self, self.usage)
|
||||
|
||||
def run(self):
|
||||
raise NotImplementedMethodeError(self, self.run)
|
||||
@@ -0,0 +1,34 @@
|
||||
# help.py -- Pamhyr
|
||||
# Copyright (C) 2023 INRAE
|
||||
#
|
||||
# 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import logging
|
||||
from Scripts.AScript import AScript
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
class ScriptHello(AScript):
|
||||
name = "Hello"
|
||||
description = "Display hello"
|
||||
|
||||
def usage(self):
|
||||
logger.info(f"Usage : {self._args[0]} hello")
|
||||
|
||||
def run(self):
|
||||
logger.info("Hello from Pamhyr2 script !")
|
||||
return True
|
||||
Reference in new issue
Block a user