Skip to content

Commit

Permalink
添加鸿蒙支持
Browse files Browse the repository at this point in the history
  • Loading branch information
wswenyue committed Aug 29, 2024
1 parent 5639c8f commit d6bdc39
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/data/aklog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ class Aklog < Formula
def install
libexec.install Dir["*"]
bin.install libexec/"aklog" => "aklog"
bin.install libexec/"hilog" => "hilog"
bin.install libexec/"akhos" => "akhos"
inreplace bin/"aklog", "exe_path", "#{libexec}"
inreplace bin/"hilog", "exe_path", "#{libexec}"
inreplace bin/"akhos", "exe_path", "#{libexec}"
end

test do
system bin/"aklog", "--version"
system bin/"hilog", "--version"
system bin/"akhos", "--version"
end

end
4 changes: 2 additions & 2 deletions hilog → akhos
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ has(){

if has "python3"; then
# shellcheck disable=SC2068
python3 ${AK_DIR}/hilog.py $@
python3 ${AK_DIR}/akhos.py $@
elif has "python"; then
# shellcheck disable=SC2068
python ${AK_DIR}/hilog.py $@
python ${AK_DIR}/akhos.py $@
else
echo >&2 "Failed to execute, please install python before."
fi
10 changes: 5 additions & 5 deletions hilog.py → akhos.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _to_str_arr(obj: Any) -> List[str]:
return _targetList


class HiLogArgs(object):
class AkHosArgs(object):
dest_version = "version"
dest_package = "package"
dest_package_all = "package_all"
Expand All @@ -48,7 +48,7 @@ def __init__(self):
with open(cfg_path, 'r') as f:
self.cfg = yaml.load(f, Loader=yaml.SafeLoader)
version = self.cfg['version']
self.HI_LOG_VERSION = f"{version['prefix']}{version['major']}.{version['minor']}.x"
self.AK_HOS_VERSION = f"{version['prefix']}{version['major']}.{version['minor']}.x"

# def _define_args_package(self, args_parser: argparse.ArgumentParser):
# args_package = args_parser.add_mutually_exclusive_group()
Expand Down Expand Up @@ -219,8 +219,8 @@ def _parser_run_cmd(self, args: Dict[str, object]) -> bool:

def _define_args(self) -> argparse.ArgumentParser:
args_parser = argparse.ArgumentParser(
description=f"Harmony开发利器-HiLog-{self.HI_LOG_VERSION} (Harmony developer's Swiss Army Knife for Log)")
args_parser.add_argument('-v', '--' + self.dest_version, action=self.dest_version, version=self.HI_LOG_VERSION)
description=f"Harmony开发利器-HiLog-{self.AK_HOS_VERSION} (Harmony developer's Swiss Army Knife for Log)")
args_parser.add_argument('-v', '--' + self.dest_version, action=self.dest_version, version=self.AK_HOS_VERSION)
# package 相关参数
# self._define_args_package(args_parser)
# # tag 过滤相关参数
Expand Down Expand Up @@ -273,4 +273,4 @@ def run(self, argv: Optional[List] = None):


if __name__ == '__main__':
HiLogArgs().run()
AkHosArgs().run()
5 changes: 4 additions & 1 deletion screen_cap_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ def get_phone_cap_dir(self) -> str:

def do_capture(self):
comm_tools.create_dir_not_exists(self._dir_path)
pic_name = datetime.datetime.now().strftime("%m%d-%H%M%S-%f.png")
if self._is_harmonyos:
pic_name = datetime.datetime.now().strftime("%m%d-%H%M%S-%f.jpeg")
else:
pic_name = datetime.datetime.now().strftime("%m%d-%H%M%S-%f.png")
pic_local_path = os.path.join(self._dir_path, pic_name)
pic_phone_path = os.path.join(self.get_phone_cap_dir(), pic_name)
if self._is_harmonyos:
Expand Down

0 comments on commit d6bdc39

Please sign in to comment.