Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: tools/chrome_extensions/open_my_editor/myeditor-example/qtcreator-example.py

Issue 2720793005: Add Open my editor (Closed)
Patch Set: add owners and change to py2 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python2
2 #
3 # Copyright 2017 The Chromium 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 '''
watk 2017/03/02 23:13:49 newline before this. You might want to run these
7 This is a wrapper script to start your editor. You also need to add this script
8 to your path.
9 '''
10
11 import argparse
12 import os
13 import sh
14
15
16 def qtcreator_open_file(filepath, line=1):
17 sh.qtcreator("-client", filepath + ":" + str(line))
18
19
20 CHROMIUM_ROOT = os.environ['HOME'] + "/workspace/chromium/src"
21
22 os.chdir(CHROMIUM_ROOT)
23
24 ###### Dont change this part. BEGIN #####
25 parser = argparse.ArgumentParser()
26 parser.add_argument("-f", "--filepath", help="Filepath.")
27 parser.add_argument("-l", "--line", type=int, help="Line number.")
28 parser.add_argument("-m", "--multifilepath", help="Multi Filepath.")
29 args = parser.parse_args()
30 ###### Dont change this part. END #####
31
32 # I dont have a good idea to start a QtCreator instance, so please open it
watk 2017/03/02 23:13:49 nit: Here and in the rest of these sample files pl
33 # manually
34
35 # Open one file with line number
36 if args.filepath != None:
37 qtcreator_open_file(args.filepath, args.line)
38 # Open multi files
watk 2017/03/02 23:13:49 s/multi/multiple/
39 else:
40 for filepath in args.multifilepath.split(","):
41 qtcreator_open_file(filepath)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698