Top Level Namespace
Defined Under Namespace
Modules: RightApi Classes: RightScaleCLI
Instance Method Summary collapse
-
#ask_pass ⇒ Object
- Author
- Chris Fordham (<[email protected]>) Copyright
- Copyright © 2013 Chris Fordham License
-
Apache License, Version 2.0.
-
#yesno ⇒ Object
- Author
- Chris Fordham (<[email protected]>) Copyright
- Copyright © 2013 Chris Fordham License
-
Apache License, Version 2.0.
Instance Method Details
#ask_pass ⇒ Object
- Author
-
Chris Fordham (<[email protected]>)
- Copyright
-
Copyright © 2013 Chris Fordham
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
17 18 19 20 21 22 23 |
# File 'lib/ask_pass.rb', line 17 def ask_pass require 'io/console' print 'Password: ' password = STDIN.noecho(&:gets).strip puts return password end |
#yesno ⇒ Object
- Author
-
Chris Fordham (<[email protected]>)
- Copyright
-
Copyright © 2013 Chris Fordham
- License
-
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/yesno.rb', line 17 def yesno begin system("stty raw -echo") str = STDIN.getc ensure system("stty -raw echo") end if str.downcase == "y" return true elsif str.downcase == "n" return false else raise "Invalid response. Please enter y/n." end end |