From 1e8c803478aedfba722f022a9a815025cf6a3ef8 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 10 Apr 2015 21:09:45 -0700 Subject: [PATCH] Remove docs directory, approaching self documentation --- cmd-config.go | 3 + cmd-options.go | 11 +-- docs/commands/config.md | 23 ----- docs/commands/cp.md | 26 ----- docs/commands/ls.md | 24 ----- docs/commands/mb.md | 20 ---- docs/contributing.md | 1 - docs/debugging.md | 36 ------- docs/index.md | 79 --------------- docs/sdks/js/example-bucket-policy.js | 62 ------------ docs/sdks/js/example-list.js | 33 ------- docs/sdks/js/javascript.md | 118 ----------------------- docs/sdks/python/example-list-buckets.py | 6 -- docs/sdks/python/python.md | 34 ------- docs/sdks/ruby/example-list-buckets.rb | 10 -- docs/sdks/ruby/ruby.md | 37 ------- 16 files changed, 8 insertions(+), 515 deletions(-) delete mode 100644 docs/commands/config.md delete mode 100644 docs/commands/cp.md delete mode 100644 docs/commands/ls.md delete mode 100644 docs/commands/mb.md delete mode 120000 docs/contributing.md delete mode 100644 docs/debugging.md delete mode 100644 docs/index.md delete mode 100644 docs/sdks/js/example-bucket-policy.js delete mode 100644 docs/sdks/js/example-list.js delete mode 100644 docs/sdks/js/javascript.md delete mode 100644 docs/sdks/python/example-list-buckets.py delete mode 100644 docs/sdks/python/python.md delete mode 100644 docs/sdks/ruby/example-list-buckets.rb delete mode 100644 docs/sdks/ruby/ruby.md diff --git a/cmd-config.go b/cmd-config.go index 362416ae..c4fa2adb 100644 --- a/cmd-config.go +++ b/cmd-config.go @@ -379,6 +379,9 @@ func saveConfigCmd(ctx *cli.Context) { // doConfigCmd is the handler for "mc config" sub-command. func doConfigCmd(ctx *cli.Context) { + if len(ctx.Args()) < 1 { + cli.ShowCommandHelpAndExit(ctx, "config", 1) // last argument is exit code + } switch true { case ctx.Bool("completion") == true: getBashCompletionCmd() diff --git a/cmd-options.go b/cmd-options.go index d170d716..c64027d1 100644 --- a/cmd-options.go +++ b/cmd-options.go @@ -93,7 +93,7 @@ EXAMPLES: mbCmd = cli.Command{ Name: "mb", Usage: "makes a bucket", - Description: "Creates an S3 bucket", + Description: `Creates a bucket on Amazon S3, Minio Object Storage and Filesystem`, Action: doMakeBucketCmd, CustomHelpTemplate: `NAME: mc {{.Name}} - {{.Usage}} @@ -121,11 +121,10 @@ EXAMPLES: configCmd = cli.Command{ Name: "config", Usage: "Generate configuration \"" + mustGetMcConfigPath() + "\" file.", - Description: `Configure minio client configuration data. If your config - file does not exist (the default location is ~/.auth), it will be - automatically created for you. Note that the configure command only writes - values to the config file. It does not use any configuration values from - the environment variables.`, + Description: `Configure minio client configuration. + + NOTE: that the configure command only writes values to the config file. + It does not use any configuration values from the environment variables.`, Action: doConfigCmd, Flags: []cli.Flag{ cli.StringFlag{ diff --git a/docs/commands/config.md b/docs/commands/config.md deleted file mode 100644 index 846107c2..00000000 --- a/docs/commands/config.md +++ /dev/null @@ -1,23 +0,0 @@ -#### generate config - -``` -NAME: - config - Generate configuration "/home/alexa/.mc/config.json" file. - -USAGE: - command config [command options] [arguments...] - -DESCRIPTION: - Configure minio client configuration data. If your config - file does not exist (the default location is ~/.auth), it will be - automatically created for you. Note that the configure command only writes - values to the config file. It does not use any configuration values from - the environment variables. - -OPTIONS: - --accesskeyid, -a AWS access key ID - --secretkey, -s AWS secret access key - --alias Add aliases into config - --completion Generate bash completion "/home/alexa/.mc/mc.bash_completion" file. - -``` \ No newline at end of file diff --git a/docs/commands/cp.md b/docs/commands/cp.md deleted file mode 100644 index cd61345b..00000000 --- a/docs/commands/cp.md +++ /dev/null @@ -1,26 +0,0 @@ -#### copy objects - -``` -NAME: - mc cp - copy objects and files - -USAGE: - mc cp [ARGS...] SOURCE TARGET [TARGET...] - -DESCRIPTION: - Copy files and objects recursively between Amazon S3, Minio Object Storage and Filesystem - -OPTIONS: - --recursive, -r recursively crawls a given directory or bucket - -EXAMPLES: - 1. Copy an object from Amazon S3 object storage to local fileystem. - $ mc cp https://s3.amazonaws.com/jukebox/klingon_opera_aktuh_maylotah.ogg wakeup.ogg - - 2. Copy a bucket recursive from Minio object storage to Amazon S3 object storage - $ mc cp --recursive http://localhost:9000/photos/burningman2011 https://s3.amazonaws.com/burningman/ - - 3. Copy a local folder to Minio object storage and Amazon S3 object storage - $ mc cp --recursive backup/ http://localhost:9000/archive/ https://s3.amazonaws.com/archive/ - -``` \ No newline at end of file diff --git a/docs/commands/ls.md b/docs/commands/ls.md deleted file mode 100644 index aba5ce89..00000000 --- a/docs/commands/ls.md +++ /dev/null @@ -1,24 +0,0 @@ -#### list objects - -``` -NAME: - mc ls - list files and objects - -USAGE: - mc ls TARGET - -DESCRIPTION: - List files and objects recursively between Amazon S3, Minio Object Storage and Filesystem - -EXAMPLES: - 1. List objects on Minio object storage - $ mc ls http://localhost:9000/backup/ - 2015-03-28 12:47:50 PDT 51.00 MB 2006-Jan-1/backup.tar.gz - 2015-03-31 14:46:33 PDT 55.00 MB 2006-Mar-1/backup.tar.gz - - 2. List buckets on Amazon S3 object storage - $ mc ls https://s3.amazonaws.com/ - 2015-01-20 15:42:00 PST rom - 2015-01-15 00:05:40 PST zek - -``` \ No newline at end of file diff --git a/docs/commands/mb.md b/docs/commands/mb.md deleted file mode 100644 index 48f0d027..00000000 --- a/docs/commands/mb.md +++ /dev/null @@ -1,20 +0,0 @@ -#### make bucket - -``` -NAME: - mc mb - makes a bucket - -USAGE: - mc mb TARGET - -DESCRIPTION: - Creates an S3 bucket - -EXAMPLES: - 1. Create a bucket on Amazon S3 object storage - $ mc mb https://s3.amazonaws.com/public-photo-store - - 2. Create a bucket on Minio object storage - $ mc mb http://localhost:9000/mongodb-backup - -``` \ No newline at end of file diff --git a/docs/contributing.md b/docs/contributing.md deleted file mode 120000 index 44fcc634..00000000 --- a/docs/contributing.md +++ /dev/null @@ -1 +0,0 @@ -../CONTRIBUTING.md \ No newline at end of file diff --git a/docs/debugging.md b/docs/debugging.md deleted file mode 100644 index 9a6dbc62..00000000 --- a/docs/debugging.md +++ /dev/null @@ -1,36 +0,0 @@ -### Debugging ``mc`` commands - -#### mb [DEBUG] -``` -$ mc --debug mb localhost:localbucket -PUT /localbucket HTTP/1.1 -Host: localhost:9000 -User-Agent: Minio s3Client -Content-Length: 0 -Authorization: AWS **PASSWORD**STRIPPED** -Date: Wed, 08 Apr 2015 23:44:29 GMT -Accept-Encoding: gzip - -HTTP/1.1 200 OK -``` - -#### ls [DEBUG] -``` -$ mc --debug ls localhost: -GET / HTTP/1.1 -Host: localhost:9000 -User-Agent: Minio s3Client -Authorization: AWS **PASSWORD**STRIPPED** -Date: Wed, 08 Apr 2015 23:42:36 GMT -Accept-Encoding: gzip - -HTTP/1.1 200 OK -Connection: close -Content-Length: 221 -Accept-Ranges: bytes -Content-Type: application/xml -Date: Wed, 08 Apr 2015 23:42:36 GMT -Server: Minio - -2015-04-08 09:42:36 PDT newbucket -``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 0b59bf4a..00000000 --- a/docs/index.md +++ /dev/null @@ -1,79 +0,0 @@ -# Minio Client - -mc - Minio Client for S3 Compatible Object Storage released under [Apache license v2](./LICENSE). - -## Install - -``` -# go get github.com/minio-io/mc -``` - -## Usage - -### Commands -``` -$ mc help - -NAME: - mc - Minio Client for S3 Compatible Object Storage - -USAGE: - mc [global options] command [command options] [arguments...] - -VERSION: - <---- GIT COMMIT ID ----> - -BUILD: - <---- BUILD TIME ----> - -COMMANDS: - cp copy objects and files - ls list files and objects - mb makes a bucket - config Generate configuration "/home/alexa/.mc/config.json" file. - -GLOBAL OPTIONS: - --debug enable HTTP tracing - --quiet, -q disable chatty output, such as the progress bar - --version, -v print the version - -``` - -## Contribute - -[Contribute to mc](./contributing.md) - -### Supported platforms - -| Name | Supported | -| ------------- | ------------- | -| Linux | Yes | -| Windows | Yes | -| Mac OSX | Yes | - -### Supported architectures - -| Arch | Supported | -| ------------- | ------------- | -| x86-64 | Yes | -| arm64 | Not yet| -| i386 | Not yet | - -### Enable bash completion - -To generate bash completion for ``mc`` all you have to do is - -``` -$ mc config --completion - -Configuration written to /home/user/.mc/mc.bash_completion - -$ source ${HOME}/.mc/mc.bash_completion -$ echo 'source ${HOME}/.mc/mc.bash_completion' >> ${HOME}/.bashrc - -``` - -``` -$ mc -config cp h help ls mb -``` diff --git a/docs/sdks/js/example-bucket-policy.js b/docs/sdks/js/example-bucket-policy.js deleted file mode 100644 index b7ff48a5..00000000 --- a/docs/sdks/js/example-bucket-policy.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict' - -var AWS = require('aws-sdk'); - -var config = { - accessKeyId: "ECHB22VEKH5I0X4K2T7P", - secretAccessKey: "IiqhtimkamPZJtV4J8jztm74LpdTSbn7RUASyPzjje2+pfhLJ7nFRg==", - endpoint: "localhost:9000", - region: "", - sslEnabled: false, - s3ForcePathStyle: true, -}; - -AWS.config.update(config); - -var s3 = new AWS.S3(); - -var statement = { - Sid: "ExampleStatemenent1", - Effect: "Allow", - Principal: { - AWS: "minio::1111111:murphy" - }, - Action: [ - "minio:ListBucket", - "minio:GetObject", - "minio:PutObject", - ], - Resource: [ - "minio:::examplebucket" - ] -} - -var policy = { - Version: "2012-10-20", - Statement: [statement], -} - -var params = { - Bucket: 'docs', - Policy: JSON.stringify(policy), -} - -s3.putBucketPolicy(params, function(err, data) { - if (err) { - console.log(err); - } else { - console.log(data); - } -}); - -var params = { - Bucket: 'docs' -}; - -s3.getBucketPolicy(params, function(err, data) { - if (err) { - console.log(err); - } else { - console.log(data); - } -}); diff --git a/docs/sdks/js/example-list.js b/docs/sdks/js/example-list.js deleted file mode 100644 index afa01758..00000000 --- a/docs/sdks/js/example-list.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -var AWS = require('aws-sdk'); - -var config = { - accessKeyId: "ECHB22VEKH5I0X4K2T7P", - secretAccessKey: "IiqhtimkamPZJtV4J8jztm74LpdTSbn7RUASyPzjje2+pfhLJ7nFRg==", - endpoint: "localhost:9000", - region: "", - sslEnabled: false, - s3ForcePathStyle: true, -}; - -AWS.config.update(config); - -var s3 = new AWS.S3(); -s3.listBuckets(function(err, data) { - if (err) { - console.log(err); // an error occurred - } else { - console.log(data); // successful response - } -}); - - -var params = { - Bucket: "docs" -}; - -s3.listObjects(params, function(err, data) { - if (err) console.log(err); - else console.log(data); -}); diff --git a/docs/sdks/js/javascript.md b/docs/sdks/js/javascript.md deleted file mode 100644 index 0ed7aed7..00000000 --- a/docs/sdks/js/javascript.md +++ /dev/null @@ -1,118 +0,0 @@ -# Using AWS SDK for Javascript - -## Install - -### In Node.js - -``` -npm install aws-sdk -``` - -### Example ``GetService`` and ``ListObjects`` - -``` -'use strict' - -var AWS = require('aws-sdk'); - -var config = { - accessKeyId: "ECHB22VEKH5I0X4K2T7P", - secretAccessKey: "IiqhtimkamPZJtV4J8jztm74LpdTSbn7RUASyPzjje2+pfhLJ7nFRg==", - endpoint: "localhost:9000", - region: "", - sslEnabled: false, - s3ForcePathStyle: true, -}; - -AWS.config.update(config); - -var s3 = new AWS.S3(); -s3.listBuckets(function(err, data) { - if (err) { - console.log(err); // an error occurred - } else { - console.log(data); // successful response - } -}); - - -var params = { - Bucket: "docs" -}; - -s3.listObjects(params, function(err, data) { - if (err) console.log(err); - else console.log(data); -}); -``` - -Grab it here [example-list.js](https://github.com/Minio-io/mc/blob/master/docs/sdks/js/example-list.js) - -### Example ``GetBucketPolicy`` and ``PutBucketPolicy`` - -``` -'use strict' - -var AWS = require('aws-sdk'); - -var config = { - accessKeyId: "ECHB22VEKH5I0X4K2T7P", - secretAccessKey: "IiqhtimkamPZJtV4J8jztm74LpdTSbn7RUASyPzjje2+pfhLJ7nFRg==", - endpoint: "localhost:9000", - region: "", - sslEnabled: false, - s3ForcePathStyle: true, -}; - -AWS.config.update(config); - -var s3 = new AWS.S3(); - -var statement = { - Sid: "ExampleStatemenent1", - Effect: "Allow", - Principal: { - AWS: "minio::1111111:murphy" - }, - Action: [ - "minio:ListBucket", - "minio:GetObject", - "minio:PutObject", - ], - Resource: [ - "minio:::examplebucket" - ] -} - -var policy = { - Version: "2012-10-20", - Statement: [statement], -} - -var params = { - Bucket: 'docs', - Policy: JSON.stringify(policy), -} - -s3.putBucketPolicy(params, function(err, data) { - if (err) { - console.log(err); - } else { - console.log(data); - } -}); - -var params = { - Bucket: 'docs' -}; - -s3.getBucketPolicy(params, function(err, data) { - if (err) { - console.log(err); - } else { - console.log(data); - } -}); -``` - -Grab it here [example-bucket-policy.js](https://github.com/Minio-io/mc/blob/master/docs/sdks/js/example-bucket-policy.js) diff --git a/docs/sdks/python/example-list-buckets.py b/docs/sdks/python/example-list-buckets.py deleted file mode 100644 index 0d1cf793..00000000 --- a/docs/sdks/python/example-list-buckets.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env python - -import boto3 -s3 = boto3.resource('s3', use_ssl=False, endpoint_url="http://localhost:9000") -for bucket in s3.buckets.all(): - print(bucket.name) diff --git a/docs/sdks/python/python.md b/docs/sdks/python/python.md deleted file mode 100644 index daee0f63..00000000 --- a/docs/sdks/python/python.md +++ /dev/null @@ -1,34 +0,0 @@ -# Using AWS SDK for Python - -## Install - -### In Python 2.6, 2.7, 3.3, 3.4 - -**WARNING**: Boto 3 is in *developer preview* and **should not** be used in production yet! - -``` -pip install boto3 -``` - -### Example - -Next, set up credentials (in e.g. ``~/.aws/credentials``):: - - [default] - aws_access_key_id = YOUR_MINIO_ACCESS_ID - aws_secret_access_key = YOUR_MINIO_SECRET_KEY - -``` -#!/usr/bin/env python - -import boto3 -s3 = boto3.resource('s3', use_ssl=False, endpoint_url="http://localhost:9000") -for bucket in s3.buckets.all(): - print(bucket.name) -... -bucket1 -bucket2 -bucket3 -``` - -Grab it here [example-list-buckets.py](https://github.com/Minio-io/mc/blob/master/docs/sdks/python/example-list-buckets.py) \ No newline at end of file diff --git a/docs/sdks/ruby/example-list-buckets.rb b/docs/sdks/ruby/example-list-buckets.rb deleted file mode 100644 index 0497ec27..00000000 --- a/docs/sdks/ruby/example-list-buckets.rb +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby -require 'aws-sdk' - -s3 = Aws::S3::Client.new(endpoint: "http://localhost:9000/", - require_https_for_sse_cpk: false, - region: "minio") -resp = s3.list_buckets -resp.buckets.each do |bucket| - puts "#{bucket.name} => #{bucket.creation_date}" -end diff --git a/docs/sdks/ruby/ruby.md b/docs/sdks/ruby/ruby.md deleted file mode 100644 index a4faa779..00000000 --- a/docs/sdks/ruby/ruby.md +++ /dev/null @@ -1,37 +0,0 @@ -# Using AWS SDK for Ruby - Version 2 - -## Install - -### In Ruby 1.9 - -``` -gem install aws-sdk -``` - -### Example - -Next, set up credentials (in e.g. ``~/.aws/credentials``):: - - [default] - aws_access_key_id = YOUR_MINIO_ACCESS_ID - aws_secret_access_key = YOUR_MINIO_SECRET_KEY - -``` -#!/usr/bin/env ruby -require 'aws-sdk' - -s3 = Aws::S3::Client.new(endpoint: "http://127.0.0.1:9000/", - require_https_for_sse_cpk: false, - region: "minio") -resp = s3.list_buckets -resp.buckets.each do |bucket| - puts "#{bucket.name} => #{bucket.creation_date}" -end -``` - -#### NOTE: - -ruby ``aws-sdk`` requires region name should be set, please use any name which -makes sense. Specifically for this example we choose ``minio`` - -Grab it here [example-list-buckets.rb](https://github.com/Minio-io/mc/blob/master/docs/sdks/ruby/example-list-buckets.rb) \ No newline at end of file