blob: a03ae798c8520dcb34c8f99e17b06c5e2ba9c76f [file] [log] [blame]
Jon Salzf10ef792014-04-01 14:25:36 +08001#!/usr/bin/python
2#
3# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7
8"""A command-line tool for reg code handling."""
9
10
11import factory_common # pylint: disable=W0611
12from cros.factory.hacked_argparse import CmdArg, Command, ParseCmdline
13from cros.factory.test.registration_codes import RegistrationCode
14
15
16@Command('decode',
17 CmdArg('regcode', metavar='REGCODE',
18 help='Encoded registration code string'))
19def Decode(options):
20 reg_code = RegistrationCode(options.regcode)
21 if reg_code.proto:
22 print reg_code.proto
23 else:
24 print reg_code
25
26
27def main():
28 options = ParseCmdline('Registration code tool.')
29 options.command(options)
30
31
32if __name__ == '__main__':
33 main()