Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • ion ion
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 93
    • Issues 93
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • redox-osredox-os
  • ionion
  • Merge requests
  • !1189

Make all variables show when running `let`

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Tom Almeida requested to merge Tommoa/ion:feature/let-shows-all-vars into master Mar 17, 2020
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 2

Before this patch, let only shows string and array variables, whilst all mapping types are not shown. In addition, string and array variables are separated from each other by comments.

This patch implements a new function on shell::Variables that returns all the variables in scope and then modifies Shell::list_vars to print all the variables. The syntax returned is equivalent to the method of declaring the variables themselves, however this still results in mapping types being indistinguishable from each other by looking at the output of let (both HashMap and BTreeMap look the same).

Example

Current

# String Variables
HISTORY_SIZE = 1000
HISTFILE_SIZE = 100000
HISTORY_TIMESTAMP = 0
PID = 35715
CMD_DURATION = 91827
UID = 501
? = 0
EUID = 501
HISTFILE_ENABLED = 1

# Array Variables
HISTORY_IGNORE = [ 'no_such_command' , 'whitespace' , 'duplicates' ]
args = [ '-ion' ]
CDPATH = [ ]

New

HISTFILE_SIZE = 100000
HISTORY_IGNORE = [ 'no_such_command', 'whitespace', 'duplicates' ]
args = [ 'target/debug/ion' ]
CDPATH = [ ]
? = 0
PID = 50741
UID = 501
HISTORY_SIZE = 1000
EUID = 501
HISTORY_TIMESTAMP = 0
HISTFILE_ENABLED = 1
CMD_DURATION = 0
icon = [ 'c'='d', 'a'='b', 'b'='c' ]
Edited Mar 17, 2020 by Tom Almeida
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: feature/let-shows-all-vars