diff frontends/src/quick_frontend/quick_utils.py @ 1367:f71a0fc26886

merged branch frontends_multi_profiles
author Goffi <goffi@goffi.org>
date Wed, 18 Mar 2015 10:52:28 +0100
parents faa1129559b8
children 069ad98b360d
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_utils.py	Thu Feb 05 11:59:26 2015 +0100
+++ b/frontends/src/quick_frontend/quick_utils.py	Wed Mar 18 10:52:28 2015 +0100
@@ -17,20 +17,9 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from sat_frontends.tools.jid  import JID
+from sat.core.i18n import _
 from os.path import exists, splitext
-from sat_frontends.quick_frontend.constants import Const
-
-def escapePrivate(ori_jid):
-    """Escape a private jid"""
-    return JID(Const.PRIVATE_PREFIX + ori_jid.bare + '@' + ori_jid.resource)
-
-def unescapePrivate(escaped_jid):
-    if not escaped_jid.startswith(Const.PRIVATE_PREFIX):
-        return escaped_jid
-    escaped_split = tuple(escaped_jid[len(Const.PRIVATE_PREFIX):].split('@'))
-    assert(len(escaped_split) == 3)
-    return JID("%s@%s/%s" % escaped_split)
+from optparse import OptionParser
 
 def getNewPath(path):
     """ Check if path exists, and find a non existant path if needed """
@@ -44,3 +33,19 @@
             return new_path
         idx+=1
 
+def check_options():
+    """Check command line options"""
+    usage = _("""
+    %prog [options]
+
+    %prog --help for options list
+    """)
+    parser = OptionParser(usage=usage) # TODO: use argparse
+
+    parser.add_option("-p", "--profile", help=_("Select the profile to use"))
+
+    (options, args) = parser.parse_args()
+    if options.profile:
+        options.profile = options.profile.decode('utf-8')
+    return options
+