当前位置: 首页 > news >正文

网站建设产品中心宜昌网站建设设计

网站建设产品中心,宜昌网站建设设计,门户网站建设说明书,saas小程序开发文章目录 一、CLI Utilities Rust 学完#xff0c;想找些练手的项目#xff0c;怎么办#xff1f;可参考这个文章#xff0c;列出的 15 个项目。 一、CLI Utilities github 参考 lsd 项目地址 cargo.toml [dependencies] clap 2main.rs extern crate cl… 文章目录 一、CLI Utilities Rust 学完想找些练手的项目怎么办可参考这个文章列出的 15 个项目。 一、CLI Utilities github 参考 lsd 项目地址 cargo.toml [dependencies] clap 2main.rs extern crate clap;use clap::{App, Arg};fn main() {let app App::new(l).version(1.0.0).author(y).about(this is a l).arg(Arg::with_name(all).short(a).help(show all file and dir),).arg(Arg::with_name(long).short(l).help(show file all info)).arg(Arg::with_name(FILE).multiple(true).default_value(.)).get_matches();let all app.is_present(all);let long app.is_present(long);let files: Vecstr app.values_of(FILE).expect(not get any file).collect();println!(all: {}, long: {}, File: {:?}, all, long, files); }运行已经可以收到命令行参数了如下 # cargo run all: false, long: false, File: [.]# cargo run -- -a -l /tmp /etc all: true, long: true, File: [/tmp, /etc]接下来读取某路径下的文件 extern crate clap;use std::{fs::read_dir, path::Path};fn main() {let files vec![/Users];for file in files {let path Path::new(file);if path.is_dir() {println!({} is a directory, file);let somes read_dir(path).expect(not get this path);for some in somes {if let Ok(ref entry) some {let name entry.file_name().to_str().expect(file name convert str fail).to_string();let data entry.metadata().expect(no metadata);println!({} {:?}, name, data)}}}} }接下来把两个程序结合 extern crate clap;use clap::{App, Arg}; use std::fs::read_dir; use std::os::unix::fs::PermissionsExt; use std::path::Path;#[derive(Debug)] pub struct Option {display_all: bool,display_long: bool, }fn main() {let app App::new(l).version(1.0.0).author(lome).about(this is a l).arg(Arg::with_name(all).short(a).help(Show all file and dir),).arg(Arg::with_name(long).short(l).help(show file all info)).arg(Arg::with_name(FILE).multiple(true).default_value(.)).get_matches();let option Option {display_all: app.is_present(all),display_long: app.is_present(long),};let files: Vecstr app.values_of(FILE).expect(not get any file).collect();for file in files {let path Path::new(file);if path.is_dir() {println!({}: , file);let somes read_dir(path).expect(not get this path);for some in somes {if let Ok(ref entry) some {let name entry.file_name().to_str().expect(file name convert str fail).to_string();let data entry.metadata().expect(no metadata);if option.display_long {if option.display_all || !name.starts_with(.) {let permission data.permissions().mode();let systime data.modified().expect(get system time error);println!( {} Permission: {:o} Systime: {:?},name, permission, systime);}} else {if option.display_all || !name.starts_with(.) {println!( {}, name);}}}}}} }// code result: Output $ ./l ./test/ ./test/test/ ./test/: test.txttest ./test/test/: test.txt$ ./l -a ./test/ ./test/test/ ./test/: test.txttest.test.txt ./test/test/: test.txt$ ./l -al ./test/ ./test/test/ ./test/: test.txt Permission: 100644 Systime: SystemTime { tv_sec: 1573805933, tv_nsec: 470337261 }test Permission: 40755 Systime: SystemTime { tv_sec: 1573805940, tv_nsec: 228706396 }.test.txt Permission: 100644 Systime: SystemTime { tv_sec: 1573806564, tv_nsec: 333715123 } ./test/test/: test.txt Permission: 100644 Systime: SystemTime { tv_sec: 1573805940, tv_nsec: 228706396 }
http://wiki.neutronadmin.com/news/346507/

相关文章:

  • 网站的可视化设计诸城做网站收费
  • 做网站需要多少钱济宁程序员招聘
  • 东莞网站建设模具二手站网站怎做
  • 专业的国内网站建设公司企业网站ppt怎么做
  • 自适应网站模板下载大型茶叶网站建设
  • 网站底部图标小程序源码怎么导入
  • 济南企业网站推广国外购物平台
  • 商城火车站专题网站开发工具
  • 驻马店网站建设zmdsem在线建站网站
  • html写手机网站吗广州网络推广服务
  • 单位建设一个网站的费用wordpress 地址插件
  • wordpress主题dedecms网站专业优化公司
  • 洪湖网站建设上海seo公司推荐
  • 深圳专业网站建设制作价格江门网站制作计划
  • 新乡哪有网站建设公司山东做网站建设公司排名
  • wordpress站长统计代码铸铁加工平台
  • icp备案查询网站优化推广
  • 小地方做外卖网站怎样江门建站模板搭建
  • 浪琴手表网站买网站做设计参考属于什么费用
  • wordpress建立仿站微信分享网站显示图片
  • 上海高端网站建设如何查询企业联系方式
  • 徐闻网站开发公司网站如何做淘宝支付
  • 电线电缆做销售哪个网站好wordpress手机如何登陆
  • 购物平台网站建设网上国网推广经验
  • 外贸营销网站推广绿色食品网站模板.htm
  • 建行官网官网网站吗软件平台运维方案
  • 牛商网营销型网站多少钱网页设计代码大全模板
  • 龙岩网站设计 贝壳下拉怎么做网站的搜索引擎
  • 哪里有网站设计的公司网络设计工资有多少
  • 能发朋友圈的网站建设语建设个定制网站需要多少钱