Merge lp:~voldyman/pantheon-terminal/parameter-at-launch into lp:~elementary-apps/pantheon-terminal/trunk

Proposed by Akshay Shekher
Status: Merged
Merged at revision: 410
Proposed branch: lp:~voldyman/pantheon-terminal/parameter-at-launch
Merge into: lp:~elementary-apps/pantheon-terminal/trunk
Diff against target: 73 lines (+31/-1)
2 files modified
src/PantheonTerminal.vala (+21/-1)
src/PantheonTerminalWindow.vala (+10/-0)
To merge this branch: bzr merge lp:~voldyman/pantheon-terminal/parameter-at-launch
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+140102@code.launchpad.net

Description of the change

pantheon-terminal -x "command"

a new terminal will open and execute the "command"

multiple -x "cmd" can be used to execute multiple commands in multiple tabs

To post a comment you must log in.
Revision history for this message
David Gomes (davidgomes) wrote :

""}, -> "" },
cmd [i] -> cmd[i]

New line after .diff's line 39.

Revision history for this message
David Gomes (davidgomes) :
review: Needs Fixing
Revision history for this message
David Gomes (davidgomes) wrote :

Newline after diff's 22nd line.

review: Needs Fixing
409. By Akshay Shekher

Added parameter to start command at launch.

Revision history for this message
David Gomes (davidgomes) wrote :

Code is all good. I already tested this and it works, but we need to talk some more about this before it gets merged.

Revision history for this message
David Gomes (davidgomes) wrote :

Nice job.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/PantheonTerminal.vala'
2--- src/PantheonTerminal.vala 2012-11-23 19:38:28 +0000
3+++ src/PantheonTerminal.vala 2012-12-19 08:49:20 +0000
4@@ -33,11 +33,13 @@
5
6 static string app_cmd_name;
7 static string app_shell_name;
8+ [CCode (array_length = false, array_null_terminated = true)]
9+ static string[]? command = null;
10 static bool print_version;
11
12 public int minimum_width;
13 public int minimum_height;
14-
15+
16 construct {
17 print_version = false;
18 build_data_dir = Constants.DATADIR;
19@@ -85,6 +87,11 @@
20 warning (e.message);
21 }
22 }
23+
24+ if (command != null) {
25+ new_window_with_command (command);
26+ return;
27+ }
28 new_window ();
29 }
30
31@@ -102,9 +109,22 @@
32 add_window (window);
33 }
34
35+ public void new_window_with_command (string[] cmd) {
36+ var window = new PantheonTerminalWindow (this);
37+ window.show ();
38+ windows.append (window);
39+ add_window (window);
40+ window.exec_cmd (cmd[0]);
41+
42+ for (int i = 1; i < cmd.length; i++) {
43+ window.new_tab_with_cmd (cmd[i]);
44+ }
45+ }
46+
47 static const OptionEntry[] entries = {
48 { "shell", 's', 0, OptionArg.STRING, ref app_shell_name, N_("Set shell at launch"), "" },
49 { "version", 'v', 0, OptionArg.NONE, out print_version, "Print version info and exit", null },
50+ { "execute" , 'x', 0, OptionArg.STRING_ARRAY, ref command, N_("Command to execute at launch"), "" },
51 { null }
52 };
53
54
55=== modified file 'src/PantheonTerminalWindow.vala'
56--- src/PantheonTerminalWindow.vala 2012-11-23 22:54:32 +0000
57+++ src/PantheonTerminalWindow.vala 2012-12-19 08:49:20 +0000
58@@ -444,6 +444,16 @@
59 t.grab_focus ();
60 }
61
62+ public void new_tab_with_cmd (string cmd) {
63+ new_tab ();
64+ exec_cmd (cmd);
65+ }
66+
67+ public void exec_cmd (string cmd) {
68+ var _cmd = cmd + "\n";
69+ current_terminal.feed_child (_cmd, _cmd.length);
70+ }
71+
72 static string get_term_font () {
73 string font_name;
74

Subscribers

People subscribed via source and target branches