螺旋一驱 CLI
Helix 单驱动命令行接口工具
状态
安装
$ npm install @adobe/helix-onedrive-cli
使用量
Usage: 1d <command>
Commands:
1d me Show information about the logged in user.
1d login Start the login interactive flow or ROPC flow with username / password.
1d logout Logout be removing the authorization file.
1d resolve <link> Resolves a share link to the respective drive item.
1d ls [path] Lists the contents of the [path]
1d get <path> [local] downloads the file at path
1d put <local> [path]] upload the local file.
Options:
--version Show version number
--verbose, -v Run with verbose logging
--help Show help
设置
1d 客户端使用默认客户端ID运行,该客户端支持交互登录. 走开
1d login,复制在浏览器中粘贴授权代码并唱入微软.
如果您想要以不同的参数运行客户端, 您可以提供
(单位:千美元) .env 包含您的应用程序的 azure 客户端身份和客户端机密的文件 .
# azure app oauth secrets
AZURE_APP_CLIENT_ID="11111111-1111-1111-1111-11111111111"
AZURE_APP_CLIENT_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
之后 .env 设置,启动 dev 服务器 改为:
$ npm start
并打开浏览器 http://localhost:4502/.
点击链接登录。 在成功登录到微软后, 服务器会写一个 .auth.json 在磁盘上.
之后可以停止服务器,并使用 cli, 如:
$ 1d me
Logged in as: John Doe ([email protected])
要重设认证,只需删除 .auth.json 文件,并以私人模式打开浏览器.
登录设备令牌
要登录设备符号, 请运行 :
$ 1d login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code HNGP5CAF8 to authenticate.
updated .auth.json file.
$ 1d me
Logged in as: John Doe ([email protected])
登录用户名/ 密码
一些账户和app允许登录用户名和密码(ROPC流量). 通常联邦账户需要外交部, 禁止使用ROPC.
$ 1d login [email protected]
password: ****
updated .auth.json file.
Logged in as: John Doe ([email protected])
发展
构建
$ npm install
测试
$ npm test
林特
$ npm run lint