summaryrefslogtreecommitdiff
path: root/xmake/actions/require/impl
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-31 21:43:47 +0800
committerruki <[email protected]>2020-05-31 21:43:47 +0800
commit41bd7287e986fcf881c8d20494058c576bbcf252 (patch)
tree49d6b3d7082d87d37ff656ace7a0cd710245fda6 /xmake/actions/require/impl
parent3c1d11faa2ca0c6e6eb1664ee938d5c49867b02d (diff)
add tty and replace clearline
Diffstat (limited to 'xmake/actions/require/impl')
-rw-r--r--xmake/actions/require/impl/action/download.lua9
-rw-r--r--xmake/actions/require/impl/action/install.lua5
-rw-r--r--xmake/actions/require/impl/package.lua5
3 files changed, 11 insertions, 8 deletions
diff --git a/xmake/actions/require/impl/action/download.lua b/xmake/actions/require/impl/action/download.lua
index 16e68eb20..b09e77011 100644
--- a/xmake/actions/require/impl/action/download.lua
+++ b/xmake/actions/require/impl/action/download.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.tty")
import(".utils.filter")
import("net.http")
import("devel.git")
@@ -35,7 +36,7 @@ function _checkout(package, url, sourcedir, url_alias)
-- clean the previous build files
git.clean({repodir = packagedir, force = true})
- utils.clearline()
+ tty.erase_line_to_start().cr()
return
end
@@ -64,7 +65,7 @@ function _checkout(package, url, sourcedir, url_alias)
os.mv(sourcedir .. ".tmp", sourcedir)
-- trace
- utils.clearline()
+ tty.erase_line_to_start().cr()
cprint("${yellow} => ${clear}clone %s %s .. ${color.success}${text.success}", url, package:version_str())
end
@@ -117,7 +118,7 @@ function _download(package, url, sourcedir, url_alias, url_excludes)
package:originfile_set(path.absolute(packagefile))
-- trace
- utils.clearline()
+ tty.erase_line_to_start().cr()
if not cached then
cprint("${yellow} => ${clear}download %s .. ${color.success}${text.success}", url)
end
@@ -200,7 +201,7 @@ function main(package)
end
-- trace
- utils.clearline()
+ tty.erase_line_to_start().cr()
if git.checkurl(url) then
cprint("${yellow} => ${clear}clone %s %s .. ${color.failure}${text.failure}", url, package:version_str())
else
diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua
index ce927c096..03edb566f 100644
--- a/xmake/actions/require/impl/action/install.lua
+++ b/xmake/actions/require/impl/action/install.lua
@@ -20,6 +20,7 @@
-- imports
import("core.base.option")
+import("core.base.tty")
import("core.project.target")
import("lib.detect.find_file")
import("test")
@@ -203,7 +204,7 @@ function main(package)
package:envs_leave()
-- trace
- utils.clearline()
+ tty.erase_line_to_start().cr()
cprint("${yellow} => ${clear}install %s %s .. ${color.success}${text.success}", package:name(), package:version_str() or "")
end,
@@ -222,7 +223,7 @@ function main(package)
end
-- trace
- utils.clearline()
+ tty.erase_line_to_start().cr()
cprint("${yellow} => ${clear}install %s %s .. ${color.failure}${text.failure}", package:name(), package:version_str() or "")
-- leave the package environments
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua
index 8f7671e60..9bc25e3a4 100644
--- a/xmake/actions/require/impl/package.lua
+++ b/xmake/actions/require/impl/package.lua
@@ -24,6 +24,7 @@ import("core.base.option")
import("core.base.global")
import("core.base.hashset")
import("core.base.scheduler")
+import("core.base.tty")
import("private.async.runjobs")
import("private.utils.progress")
import("lib.detect.cache", {alias = "detectcache"})
@@ -678,7 +679,7 @@ function _install_packages(packages_install, packages_download)
-- trace
progress_helper:clear()
- utils.clearline()
+ tty.erase_line_to_start().cr()
cprintf("${yellow} => ")
if #downloading > 0 then
cprintf("downloading ${magenta}%s", table.concat(downloading, ", "))
@@ -690,7 +691,7 @@ function _install_packages(packages_install, packages_download)
progress_helper:write()
end, exit = function(errors)
if errors then
- utils.clearline()
+ tty.erase_line_to_start().cr()
io.flush()
end
end})