Skip to content

Commit 56df615

Browse files
author
jupengfei
committed
增加部分声明,处理代码缺陷
Change-Id: I44f700592888bf0a43ef5cdbe2361548133bd1fa
1 parent d388a52 commit 56df615

File tree

6 files changed

+81
-8
lines changed

6 files changed

+81
-8
lines changed

config/server_cmds

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
# remote_command local_command
22
# file subl
3-
4-
# default must
5-
explore xdg-open
63
subl subl

core/config.lua

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
-- Copyright (C) 2018-2024 The Remote-Command Project
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
15+
--
16+
-- Configuration Parser
17+
--
18+
119
local function generate_constant (cfg)
220
return setmetatable({}, {
321
__index = function (t, k)

core/rd.lua

+19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2+
-- Copyright (C) 2018-2024 The Remote-Command Project
3+
--
4+
-- Licensed under the Apache License, Version 2.0 (the "License");
5+
-- you may not use this file except in compliance with the License.
6+
-- You may obtain a copy of the License at
7+
--
8+
-- http://www.apache.org/licenses/LICENSE-2.0
9+
--
10+
-- Unless required by applicable law or agreed to in writing, software
11+
-- distributed under the License is distributed on an "AS IS" BASIS,
12+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
-- See the License for the specific language governing permissions and
14+
-- limitations under the License.
15+
16+
--
17+
-- Remote-Command Client
18+
--
19+
120
local Socket = require("lsocket")
221
local CMD_PDU = require("cmd_pdu")
322
local PDU = require("pdu")

core/rd_server.lua

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
-- Copyright (C) 2018-2024 The Remote-Command Project
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
15+
--
16+
-- Remote-Command Server
17+
--
18+
119
local Socket = require("lsocket")
220
local Log = require("log")
321
local PDU = require("pdu")
@@ -63,7 +81,7 @@ local function get_mapped_cmd (cmd, cmd_args, cmd_path)
6381
end
6482

6583
local function get_mapped_path (cmd_path)
66-
local new_path = nil
84+
local new_path = cmd_path
6785

6886
for remote_path, local_path in pairs(server_cfg.share_directory_map) do
6987
if (string.match(cmd_path, "^" .. remote_path)) then

core/server_params.lua

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
-- Copyright (C) 2018-2024 The Remote-Command Project
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
15+
--
16+
-- Server Params Parser
17+
--
18+
119
local function parse_server (path)
220
local f = assert(io.open(path, "r"))
321
local result = {}
@@ -30,6 +48,9 @@ server_cfg = {
3048
["share_directory_map"] = parse_server(dirs), -- map remoteDir to LocalDir
3149
}
3250

51+
-- default command
52+
server_cfg.remote_cmd_map["explore"] = "xdg-open"
53+
3354
local function parse_file_type (path)
3455
local remote_cmds = server_cfg.remote_cmd_map
3556
local map = parse_server(path)

install.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
current_path=`pwd`
44
user_bashrc=$HOME/.bashrc
5-
server_dirs=config/server_dirs
5+
server_dir=config/server_dirs
66

77
write_server_params () {
8-
local remote_path=$1 local_path1=$2
9-
local target_file=$current_path/$server_dirs
8+
local remote_path=$1 local_path=$2
9+
local target_file=$current_path/$server_dir
1010

1111
sed -i "s:$remote_path.*::;d" $target_file 2>/dev/null 1>/dev/null
1212

@@ -74,4 +74,4 @@ fi
7474

7575
unset current_path
7676
unset user_bashrc
77-
unset server_dirs
77+
unset server_dir

0 commit comments

Comments
 (0)